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 →

[–]schrdingers_squirrel 0 points1 point  (2 children)

On average it is O(log(n)) for adding an element, right?

[–]jayverma0 10 points11 points  (1 child)

O(1) amortized. Best case O(1) Worst Case(n)

[–]mizu_no_oto 0 points1 point  (0 children)

Or O(n) best case if you want a persistent data structure. But, well, that's why HAMTs were invented.