We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!! Questions you might like: ✅✅✅[ Tree Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls ✅✅✅[ Graphs Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C ✅✅✅[ February Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2wrfvII0eZQsPm-MZCmHodm ✅✅✅[ January Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2wCalBcRcNjXQ0C6ku3dRkn ✅✅✅[ December Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA ✅✅✅[ November Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e ✅✅✅[ August Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe ✅✅✅July Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC- ✅✅✅June Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2xIfpptnCvUtKrUcod2zAKG ✅✅✅May Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e ✅✅✅Cracking the Coding Interview - Unique String: kzbin.info/aero/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE Struggling in a question?? Leave in a comment and we will make a video!!!🙂🙂🙂
@SurajSingh-tz1wr3 жыл бұрын
This video is so self-explanatory and the solution is so clean. Loved this video. Thanks a lot!
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@satheshbm922 жыл бұрын
The clearest explanation, I found for the problem. Great work :)
@AlgorithmsMadeEasy2 жыл бұрын
Glad it helped!
@yusufazam11132 жыл бұрын
If I am not mistaken this solution is technically incorrect, as the problem states you must insert a key value pair. In this case the solution only stores the value and uses the key for indexing purposes only.
@pritisharma89802 жыл бұрын
very clear and concise explanation,and in a short video,thanks for posting
@AnkitKumar-ys7vs6 ай бұрын
Thanks
@AlgorithmsMadeEasy6 ай бұрын
Welcome
@fantasy9960 Жыл бұрын
best of the best! thank you for your effort !
@codedestiny69553 жыл бұрын
Keep learning keep coding
@AlgorithmsMadeEasy3 жыл бұрын
yes 👍 😊
@abcdeereijgfhd32153 жыл бұрын
This is the clearest explanation I have found so far. Thank you. BTW your typing speed is unrealistic. Did you fast-forward the video or just have the fastest finger? haha~!
@AlgorithmsMadeEasy3 жыл бұрын
Thank you so much! Haha.. I fast forward. 🙂
@YNA643 жыл бұрын
Hello thanks for the video. I have a question regarding the time complexity being O(1). Why is that so? Should it not be O(n) because for each method, in the worst case, you will have to traverse through a whole list? Hope you could clarify, thank you.
@shreyamduttagupta75273 жыл бұрын
Even I had the same question. For best case scenario, the put method will have O(1) time complexity if the key is not available, but if it exists, it will have to iterate through the whole bucket to find the key and update. I feel the time complexity should be O(N/K) where N is the number of keys and K is the Size taken which is 769. Let me know what you think!
@trevorjomeihoshiwara29612 жыл бұрын
I agree about your assessment in the worst case scenario. I believe it should have been stated as O(1) time complexity amortized. On average with a properly implemented HashMap, entries, deletions, and searches should execute in constant time. This all relies on the fact that there is a reasonable load factor (The size of the hashing array vs. the number of elements to be inserted).
@xinniu31452 жыл бұрын
Thanks for sharing this answer, could anybody explain why the time complexity is O(1)? and why space complexity is O(N)? And also, at 4:18, why size of 769 makes the hashing efficient? Thank you!
@iliasolovev2663 жыл бұрын
Why did we use toRemove variable? Why just we din't remove in right there like map[bucket].remove(entry)? Because it can cause ConcurrentModificationException?
@ujjvalsharma50553 жыл бұрын
Wonderful video!! Keep making great videos
@prachiraval47283 жыл бұрын
How to print the final map after giving put and get method
@ammarshareef4623 жыл бұрын
How are we solving the issue of collisions in this problem.
@sase10173 жыл бұрын
pretty awesome, thanks!
@AlgorithmsMadeEasy2 жыл бұрын
Most welcome!! Don't forget to subscribe!!! :)
@ashwanisingh47872 жыл бұрын
Why are we creating Entry class.Can u plz explain
@sanyamgoel12593 жыл бұрын
Can we do using simple array?
@AlgorithmsMadeEasy3 жыл бұрын
Yes, we can do it. But that would not represent the actual implementation. We have shown that too in the video.
@sammedsankonatti96423 жыл бұрын
why do we use Entry object to iterate like for(Entry entry : map[bucket]). didn't get that.
@tusharjain74332 жыл бұрын
map[bucket] is the linked list have a type of entry objects
@dhruvkaran97242 жыл бұрын
in remove when we found our key y we did not break; ???
@rechinraj1113 жыл бұрын
Why have we choosen SIZE as 769 ?
@AlgorithmsMadeEasy3 жыл бұрын
you can choose any arbitrary value!! usually, we try to select a large prime number!
@rechinraj1113 жыл бұрын
@@AlgorithmsMadeEasy why only PRIME nos?
@AlgorithmsMadeEasy3 жыл бұрын
not only prime numbers. you can select any number. prime numbers give us less collision so that's a recommended practice.
@rashmikiranpandit89623 жыл бұрын
For both the methods, the space used was almost the same, I wonder why did we use so complex method then
@AlgorithmsMadeEasy3 жыл бұрын
The complex method is more in line with what an actual hashmap works on. It is discussed by keeping the interviewer in mind.
@ramkumar_balu3 жыл бұрын
Why array of LinkedList? Can it be another DS?
@AlgorithmsMadeEasy3 жыл бұрын
If you see the internal working of HashMap. You will find, it used array of LinkedList.
@harishreddy77513 жыл бұрын
This solution is good but I'm 100% sure the follow up question would be on collision which was not handled here and needs to be handled
@shreyamduttagupta75273 жыл бұрын
What do you mean? I think she explain collision and the reason of 769. She is using Modulo operator to calculate hashCode and a larger prime number to handle Collison. Isn't that enough? Let me know what you think!
@nishantchoudhary5073 Жыл бұрын
your solution in this video are not working
@lokeshsenthilkumar45223 жыл бұрын
Awesoom try to post the video before 5pm pls
@AlgorithmsMadeEasy3 жыл бұрын
Hi Lokesh, KZbin channel is not the primary job to us. We have our regular offices and can't make videos in office time. So you would see the delay. Hope you understand.
@luminraja096 ай бұрын
kzbin.info/www/bejne/f4TMo2VmbLeogbM is this the special case to handle the collision ?