Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^7: Modified Binary Search (Corrected)

by BrowserUk (Patriarch)
on Aug 11, 2011 at 16:52 UTC ( [id://919914]=note: print w/replies, xml ) Need Help??


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)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^7: Modified Binary Search (Corrected)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found