Re:The expected value of the game is positive regardless of ...
by draluy on Friday September 06, 2024 @03:10AM
(#41463685)
I dont get this. If this is true, then he found a more efficient algorithm than binary search. Why are we not using it in CS?
[ Parent
| on HN ]
Re:The expected value of the game is positive regardless of ...
by larsnystrom on Friday September 06, 2024 @03:23AM
(#41463783)
I'm no mathematician, but I think that if you know something about the probability distribution before searching, then you can be more efficient than blindly using binary search. And if you assume Ballmer is out to get you (i.e. the distribution is not random) then you can use that information to improve the search speed.
Re:The expected value of the game is positive regardless of ...
by pnt12 on Friday September 06, 2024 @04:01AM
(#41463996)
The point is that Ballmer is an adversary, and may choose the worst cases for binary search. As I understood, the algorithm in TFA holds against any choice.
As others said, if you don't expect adversary behavior in your data, it should be good enough.
Re:The expected value of the game is positive regardless of ...
by abigail95 on Friday September 06, 2024 @03:30AM
(#41463827)
Binary search wins in the average case on random data. Ballmer is not required to choose randomly.
Re:The expected value of the game is positive regardless of ...
by Lockal on Friday September 06, 2024 @03:15PM
(#41468906)
If a second party can submit adversarial values into a system, potentially causing a denial of service in a binary search (where comparisons are computationally expensive and data is unevenly distributed), there is a much simpler solution: avoid using sorted collections and binary search. Instead, use hashmaps. To address similar HashDoS attacks, many implementations (in Python, Rust, Java, etc.) use a randomized hash function, which vaguely resembles the idea of randomizing starting value for binary search.