Python converting a list to set, big O
问题 and thanks for help words = [....#Big list of words] words_set = set(words) I have hard time determine what is the complexity of set(words) when n=len(words). Is it O(n) since it moves on all the items of the list, or O(l(n-l)) when l is a single word length? Thanks for help! If there is a difference between WC and BC too. Edit: don't mind O(l(n-l)) it's mistake for repeating substring big O. 回答1: I don't understand your second option, but iterating a list is O(n) and you must iterate the