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
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
http://www.brendangregg.com/blog/2017-05-09/cpu-utilization-is-wrong.html
Always measure!
The main thing I like about Nim is that I can always make some thing faster... there are no limits.
But you got to measure!