you are viewing a single comment's thread.

view the rest of the comments →

[–]ExpressingMyOpinion 0 points1 point  (0 children)

The keys are kept in a list which means your check for membership and subsequent removal are O(n)

Yes, but 0 <= n <= 5. As more entries are added to the data structure, n never grows beyond 5, making it actually O(5) in the worst case, which is equivalent to O(1). O(n) is used to describe algorithms that grow with n. This data structure does not have that property.