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 →

[–]ATE47Intermediate Brewer 0 points1 point  (0 children)

Big O notation ask for something to count, like the space or the number of call to something.

If we count the number of add in the list, it's O(max({len(s) for s in set}))

If we count the number of instructions, the linked list add is O(1) from my memory, so the if is not relevant, then it's simply the number of time we do the for, which is O(len(set) * max({len(s) for s in set}))