1.5.3.18 Searching

1:Sorted range Searching



bool binary_search(f,f,&)

sorted range of values and return bool.



2: linear time Searching



f adjacent_find(f,f)
f adjacent_find(f,f, bpred)

the first pair of equal adjacent values in a range and return an iterator pointing to the first value of the pair.



i find(i,i,&)

return an iterator pointing to the value or end



i find_if(i,i,upred)

satisfies a predicate and return an iterator pointing to the first such value, or to the end



3: Searches for a single element from a range



f1 find_first_of(f1,f1,f2,f2)
f1 find_first_of(f1,f1,f2,f2,bpred)

std::find_first_of searches for a single element from a range within another range.



4: Below 3 algorithms searche for a whole range of elements within another range



f1 search(f1,f1,f2,f2)
f1 search(f1,f1,f2,f2)

first occurrence of a second range of values within a first range . return an iterator pointing to the first value of that first match. or end of the first range



f1 find_end(f1,f1,f2,f2)
f1 find_end(f1,f1,f2,f2,bpred)

the last occurrence of a second range of values in a first range of values and return an iterator pointing to the first value of that last match within the first range, or pointing to the end of the first range(not find)



f search_n(f,f,n,&)
f search_n(f,f,n,&,bpred)

For a contiguous sequence of n values each equal to &, return iterator to the first of those values, or the end of the range