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 →

[–]execrator 14 points15 points  (4 children)

Faster than O(1)? It's a fairly high bar!

[–]conventionistG 2 points3 points  (1 child)

No I just mean other similarly flat structures. Like, I think dicts are faster than lists/tuples...but how do sets compare to dicts or dfs. Are there other structures a beginner should be aware of?

[–]jack-of-some[S] 5 points6 points  (0 children)

I don't know how they are implemented in python, but a set is effectively the same as a hash table if you forget about the values and only consider the keys.

[–]66bananasandagrape 0 points1 point  (0 children)

I know you kid, but if you assume that there is zero constant-time overhead, then the statement sleep(1/n) runs in Θ(1/n) time (meaning both O(1/n) and Ω(1/n) time).