Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: redo entire loop

by jonadab (Parson)
on Aug 13, 2010 at 18:06 UTC ( #854966=note: print w/replies, xml ) Need Help??

in reply to redo entire loop

From an algorithm analysis perspective, avoiding a second pass is a relatively minor optimization. Your algorithm is O(n) with the second pass, and it's still O(n) with the optimization. Unless the performance is so bad that users are timing it with a clock, they won't notice the difference.

If the performance is so bad that users are timing it with a clock, you should probably think about O(log n) possibilities (such as running a binary search against a sorted index) or, depending on the nature of your data, maybe replacing the flat-file implementation with a DBMS.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://854966]
[1nickt]: Corion HPs? ugh. I was impressed with Lenovo's gaming laptops; if it weren't for the red backlighting and general flashiness of the aesthetic, I might have gone with that. But all that was until I discovered that the Dell Precision line is still around.
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;
[1nickt]: I though the gamers like that because they bash the keys so hard.
[ambrus]: and I've seen motherboards with no fast expansion ports for a video card but built-in hardware RAID advertized as "gaming".
LanX has a shaming laptop
[ambrus]: 1nickt: my impression is that the gamers like the softer springs, because fast reaction time is more important to them then feedback from keypresses to recognize typos.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2017-03-27 13:41 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.