percolate all the way up to the root the root cannot have just one child (and even if this were allowedit would be sillyif root is left with one child as result of the adoption processthen we remove the root and make its child the new root of the tree this is the only way for -tree to lose height for examplesuppose we want to remove from the -tree in figure since the leaf has only two items and its neighbor is already at its minimum of threewe combine the items into new leaf of five items as resultthe parent has only two children howeverit can adopt from neighborbecause the neighbor has four children as resultboth have three children the result is shown in figure sets and maps in the standard library the stl containers discussed in --namelyvector and list--are inefficient for searching consequentlythe stl provides two additional containersset and mapthat guarantee logarithmic cost for basic operations such as insertiondeletionand searching sets the set is an ordered container that does not allow duplicates many of the idioms used to access items in vector and list also work for set specificallynested in the set are iterator and const_iterator types that allow traversal of the setand several methods from vector and list are identically named in setincluding beginendsizeand empty the print function template described in figure will work if passed set the unique operations required by the set are the abilities to insertremoveand perform basic search (efficientlythe insert routine is aptly named insert howeverbecause set does not allow duplicatesit is possible for the insert to fail as resultwe want the return type to be able to indicate this with boolean variable howeverinsert has more complicated return type than bool this is because insert also returns an iterator that represents where is when insert returns this iterator represents either the newly inserted item or the existing item that caused the insert to failand it is usefulbecause knowing the position of the item can make removing it more efficient by avoiding the search and getting directly to the node containing the item the stl defines class template called pair that is little more than struct with members first and second to access the two items in the pair there are two different insert routinespair insertconst object )pair insertiterator hintconst object )the one-parameter insert behaves as described above the two-parameter insert allows the specification of hintwhich represents the position where should go if the hint is accuratethe insertion is fastoften ( if notthe insertion is done using the normal insertion algorithm and performs comparably with the one-parameter insert for instancethe following code might be faster using the two-parameter insert rather than the oneparameter insert