What is the time complexity of searching and inserting values into a hash set in Python?
O(1) - constant
What is the main advantage of hash sets over lists in Python?
It eliminates any duplicates
How would we look for the value 1 in the following hash set:
{0, 1, 2, 3}
print(1 in mySet)
Will return True
How can we remove values in a hash set and what is the time complexity of this operation?
mySet.remove(1), O(1) time
How can we initialize multiple values into our set?
set([1, 2, 3])
result will be = {1, 2, 3}
How can we initialize multiple values into a set using list comprehension?
mySet = {i for i in range(5)}