hi! what is the complexity of a built-in function on a set object?
can I assume it is O(1)?
Date: 18 Nov 2014 07:26
Number of posts: 6
RSS: New posts
Which built-in function?
If you are referring to the function ("item in set") then yes, it is implemented using hash tables or (dictionaries in python) and it is O(1)!
i wanted to know about 'add' function…
anyway i noticed the question doesn't consider complexity issues only loop issues, so is it ok to use a set object?