logoalt Hacker News

cubefoxyesterday at 3:04 PM2 repliesview on HN

Since binary search is already very fast with its O(log n) time complexity: are there any real world applications which could practically benefit from this improvement?


Replies

senfiajyesterday at 5:26 PM

I guess it matters if you have to do lookup in a tight loop. If you do this occasionally, I think it's not worth it, especially for complex objects with custom comparators. The algorithm is still O(log(n)) just a more advanced "divide and conquer" with smaller constant.

loegyesterday at 3:57 PM

This is a drop-in improvement for essentially any binary search over 16-bit integer members.

show 1 reply