Hi

In Java binary search returns a negative index if target not found in array 
where negative index is where to insert (as positive) to preserve sorted array.

Is upperBound/lowerBound following binary search speeds O(log n) worst case or 
linearly?

I'm too stupid to read the source code:

[https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/algorithm.nim#L281](https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/algorithm.nim#L281)

I'm guessing the shr 1 is dividing by 2 so it would be O(log n)?

Btw. the documentation on Sort and IsSorted specifies worst case as O notation, 
could be nice to add for others as well if possible.

Cheers

Reply via email to