|P is for Practical|
Re: Re: Re: Perl Idioms Explained: && and || "Short Circuit" operatorsby BrowserUk (Pope)
|on Oct 22, 2003 at 23:09 UTC||Need Help??|
Now you've confused me:)
Doesn't O(1) (in this case) mean that a condition is only tested once with the C-switch statement. Whereas the implementation shown in the OP, all tests from 0 to N where N is the met condition's lexical position within the group, hence worst case O(N) if the last case is the one chosen?
It was this bit of your post that confused me
...Im wracking my brain to see how this could be done without becoming hopelessly inefficient....
Examine what is said, not who speaks."Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail