in reply to Re^6: Modified Binary Search
in thread Modified Binary Search
LR's problem description seems to say ...
Hm. That's not how I read it, nor do I see how you could possibly derive that interpretation from the OP?
Besides Limbic~Region 'imself seemed to think it was okay and he is not exactly known for accepting incomplete solutions.
Since the above technique does linear search, it's not going to be optimal.
Perhaps what he saw that you missed, is that whilst it is a linear search, it is a linear search once over the 5 million. Ie. O(5E6).
Whereas, if you use a binary search, you'd do 600,000 * 5e6 * log 5e6 = O(20,096,910,013,008)
600,000 * log 5e6 = O(48,494,850)
|
|---|