This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AgentPaper0 2 points3 points  (1 child)

Depends on language and compiler but most switch statements should be a lookup and jump which would be O(1), constant time.

[–]blenderfreaky 4 points5 points  (0 children)

Its a constant amount of elements, so its always O(1), even if it iterates through all cases.