standard search algorithm
-
Hey guys, What I need is a standard library algorithm to find an element in an ordered vector... binary_search would be fine if it returned an iterator--? Hope this isn't a dumb question, but all the suitable looking algorithms I found took linear time- surely what I need is in there, but where do I look? Thanks, nick
-
Hey guys, What I need is a standard library algorithm to find an element in an ordered vector... binary_search would be fine if it returned an iterator--? Hope this isn't a dumb question, but all the suitable looking algorithms I found took linear time- surely what I need is in there, but where do I look? Thanks, nick
-
Hey guys, What I need is a standard library algorithm to find an element in an ordered vector... binary_search would be fine if it returned an iterator--? Hope this isn't a dumb question, but all the suitable looking algorithms I found took linear time- surely what I need is in there, but where do I look? Thanks, nick
ForwardIterator lower_bound(ForwardIterator beg, ForwardIterator end, const T& value)
returns the position of the first element greater than or equal to value. There's also a version that takes a binary comparision predicate. It's logarithmic time for random access iterators.
-
ForwardIterator lower_bound(ForwardIterator beg, ForwardIterator end, const T& value)
returns the position of the first element greater than or equal to value. There's also a version that takes a binary comparision predicate. It's logarithmic time for random access iterators.
thanks a heap dude :rose: