|The stupid question is the question not asked|
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