Title
complexity of binary_search
Status
cd1
Section
[binary.search]
Submitter
Daniel Krügler

Created on 2007-09-08.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [binary.search]/3

Complexity: At most log2(last - first) + 2 O(1) comparisons.

Date: 2010-10-21.18:28:33

[ Sophia Antipolis: ]

Alisdair prefers to apply an upper bound instead of O(1), but that would require fixing for lower_bound, upper_bound etc. as well. If he really cares about it, he'll send an issue to Howard.

Date: 2011-04-27.21:19:46

In [binary.search] p. 3 the complexity of binary_search is described as

At most log(last - first) + 2 comparisons.

This should be precised and brought in line with the nomenclature used for lower_bound, upper_bound, and equal_range.

All existing libraries I'm aware of, delegate to lower_bound (+ one further comparison). Since issue 384 has now WP status, the resolution of #787 should be brought in-line with 384 by changing the + 2 to + O(1).

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3774
2010-10-21 18:28:33adminsetmessages: + msg3773
2007-09-08 00:00:00admincreate