Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: fastest way to compare numerical strings?

by Anonymous Monk
on Jul 01, 2008 at 13:44 UTC ( [id://694946]=note: print w/replies, xml ) Need Help??


in reply to fastest way to compare numerical strings?

Is there a reason why your inner loop starts $v at 0?

Your loop seems to start by comparing 0 to 0, then to 1, then to 2...When $n increments you compare 1 to 0, 1 to 1, etc. But aren't all the comparisons for $v <= $n ones that you've already done? There doesn't seem to be an obvious value to comparing 0 to 1, and then later comparing 1 to 0. They are, after all, both members of the same list.

Could you change the inner loop to start with $v = $n + 1 and reduce the number of comparisons significantly?

  • Comment on Re: fastest way to compare numerical strings?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-19 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found