Shouldnt you initialize your table as something like [ [ None ] for i in range(self.size) ] as you are appending incase of a collision because the individual elements are not of class list? what do you think?
Now that I think about it, it makes sense to use list comprehension. By using list comprehension each element is uniquely referenced but by using '*' we're making a reference to the same object for x amount of times.
@@saianishmalla2646 but what * is doing is basically making n number of entries of None but for our program to tackle collision the entries should be of type list right so that we can append on it.. basically meaning that the entries should be [ None ]
Why did he initialize the backed in 10000 and, not in 10^6? . It is because of the number of calls? "At most 10^4 calls will be made to add, remove, and contains."
I thought, if you already have 2 in the set, adding another 2 will ignore it. but this algorithm will add another 2 anyway.
Wow, nothing can be compared to your explanation, really helpful. Thank you!
I believe sets shouldn't have elements repeating, those checks have not been done while inserting.
thanks for explaining HashSet so well
For your add you need to check if it contains. What if we add duplicate values
a very good step by step approach
Great explanation, man. Simple and straightforward.
Wonderful explanation! You are literally the best!!!
Awesome buddy... Keep up your good job.. You are educating so many people...
Ayyee thanks a lot!
Easy to understand, thank you. But I'm just wondering that the hashset should be with unique elelment?
Shouldnt you initialize your table as something like [ [ None ] for i in range(self.size) ] as you are appending incase of a collision because the individual elements are not of class list? what do you think?
Now that I think about it, it makes sense to use list comprehension. By using list comprehension each element is uniquely referenced but by using '*' we're making a reference to the same object for x amount of times.
@@saianishmalla2646 but what * is doing is basically making n number of entries of None but for our program to tackle collision the entries should be of type list right so that we can append on it.. basically meaning that the entries should be
[ None ]
@@pythonenthusiast9292 Actuallly no. We are doing [None] * size the result of that is a list itself so in that way I don't think it's a problem.
Why did he initialize the backed in 10000 and, not in 10^6? . It is because of the number of calls? "At most 10^4 calls will be made to add, remove, and contains."
Amazing explanation, thanks for this :)
thank u so much, it really helped a lot
very nicely explained!!!
Awesome video bro, well explained, because of you today i learned something.
Really understood the concept, thanks!
Amazing explanation.
Your video is epic Thankyou so much
SyntaxError: invalid syntax
^
def add(self, key: int) -> None:
Line 10 (Solution.py) i am getting this error and unable to solve this could you help?
Thank you!
Yeah if you get rid of the :int and the -> None it should work
@@saianishmalla2646 Thanks
Good job man.!
Thanks!
Thank you!
great explanantion
Thank you!
Great vid! However, none of these functions actually give O(1) time complexity like a built-in hashset. Do you have any other alternatives?
AMAZING
nice
wow