How HashMap works internally || Popular java interview question on collection (HashMap)

  Рет қаралды 597,029

Selenium Express

Selenium Express

Күн бұрын

Пікірлер: 420
@naturelove1525
@naturelove1525 5 жыл бұрын
If I'm not wrong ,it will not create another linked list ..it will just create new node and will make it was next
@SeleniumExpress
@SeleniumExpress 5 жыл бұрын
That is correct, I said that by mistake.Thank you for correcting me.😊 Please watch the next video of the playlist.I have given a complete code walkthrough. kzbin.info/www/bejne/nITNqZuFjrV1iKs
@naturelove1525
@naturelove1525 5 жыл бұрын
@@SeleniumExpress thank you ...
@gayatriyeole1795
@gayatriyeole1795 4 жыл бұрын
Very nice explanation... Can u plz tell me how to calculate hashcode and index properly. Becoz u radomly told 1111112.Internally how it is calculated plz tell.
@sagarkorde209
@sagarkorde209 4 жыл бұрын
@@gayatriyeole1795 durga sir ko refer karo
@honeyverma6549
@honeyverma6549 4 жыл бұрын
durga sir ki kaafi purani video h ab version bdl gy h java ke but Durga sir is like god of java
@BuffaloCanCode
@BuffaloCanCode 6 жыл бұрын
2 Things I want to add (correct) here 1. When you say a link-list will be added, actually it would be a node added into a particular linkedlist. 2. map.put("null", 4) is not equal to map.put(null, 4). In case of map.put("null", 4) hashcode will be calculated as normal String. What you explained for 0th index is map.put(null, 4).
@akshayjeengar2576
@akshayjeengar2576 10 ай бұрын
Watched this video yesterday before my Interview and Luckily I was asked to implement my own hashMap. My code worked in the first attempt. Kudos to you explaination.
@ajbchannel9719
@ajbchannel9719 2 жыл бұрын
OMG this guy is very nice. he helped to understand any code of java. thank you! if you can please give as more please
@basavarajnv1017
@basavarajnv1017 4 жыл бұрын
Now I really understood how hashmap works internally...u r really amazing brother.great explanation.🙏🙏👍
@prafulsurve3190
@prafulsurve3190 6 жыл бұрын
Nice video. In case of a collision if we add the new node to the beginning of the LinkedList in the bucket then we can still achieve O(1) time complexity for put() method instead of O(n). The much elegant solution to improve the hashmap collision performance would be to use self-balancing tree data structure so in the worst case traversal would be O(log n).
@irynasherepot9882
@irynasherepot9882 4 жыл бұрын
Yeah, I think Java implementation updated it as well
@praveenkumarc6948
@praveenkumarc6948 4 жыл бұрын
Thank You so much after so many videos I have understood how it works and Successfully Subscribed❤️❤️❤️
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Hi guys, hope you are doing well !! below is the link to hashmap practical video kzbin.info/www/bejne/nITNqZuFjrV1iKs Have a nice time !!
@anjumohanan3149
@anjumohanan3149 6 жыл бұрын
Easy to understand
@prashanthkr5452
@prashanthkr5452 6 жыл бұрын
Osm bro
@vamshikrishna5801
@vamshikrishna5801 6 жыл бұрын
please explain how to retrieve null key
@shibaneepattanayak8991
@shibaneepattanayak8991 6 жыл бұрын
It's map.put(null,10)...not like map.put("null",10)
@shraddhajayaraman
@shraddhajayaraman 5 жыл бұрын
Hi Please stop the fake accent.. I am sure your original accent is better than that. useful video
@ashrithareddyrondla9882
@ashrithareddyrondla9882 4 жыл бұрын
Preparing for interviews and found this very useful thanks a ton!!!!!!!!!😁👍🙏
@sumasuripaka
@sumasuripaka 3 жыл бұрын
Explanation 👌👌👌sir...u look like Telugu movie hero Aadhi. ....s/o Sai Kumar
@ramesh22kvr
@ramesh22kvr 4 жыл бұрын
you are explaining very clearly with diagrams.i have not seen like this in any other channels
@humaali4636
@humaali4636 2 жыл бұрын
Godly tutorial... Thanks alot sir. 👏👏👏
@MrSubandrio
@MrSubandrio 3 жыл бұрын
i remember that. when i was young, i make simple like a database, iam using link list, exactly iam using doubly link list .. with 'prev' and 'next' node, good job bro !.
@anuragbharti3773
@anuragbharti3773 4 жыл бұрын
Great explanation. I surprised who disliked the video.
@AnilKumar-nq5lp
@AnilKumar-nq5lp 3 жыл бұрын
I got a new job because of this tutorial, Thanks much!!!
@priyankasinghai953
@priyankasinghai953 4 жыл бұрын
Very Nice Explaination.....Thank You very much for such nice videos.....
@kumar55663
@kumar55663 3 жыл бұрын
excellent explaination ...no words needed. please do more videos like this
@AnshiSohamiamazingworld
@AnshiSohamiamazingworld 3 жыл бұрын
Very well explained for hashMap internal working🙏
@dvoorganisation459
@dvoorganisation459 Жыл бұрын
Explained Really well in such a short video. Kudos! Really Prepared before giving Videos on KZbin. I can see good confidence in your presentation. Thanks a ton!
@sindhuchary
@sindhuchary 6 жыл бұрын
aaa & aab are 2 different keys and hence the hash code will be different. Only the index could be the same and if so the second entry will be added to the linkedlist at that particular index (index 6 in this example). Now assume that I'm trying to put another value with the same key, aaa. Now the hashcode and the index of the current entry and that of the first entry at index 6 are the same. So the value that pass with the key aaa is overwritten. This is what happens when you try to put a value into a hashmap with an already existing key, as we all know the keys are to be unique otherwise the entry will be overwritten. Keep going! Best wishes!
@Sri_Gayatri_1
@Sri_Gayatri_1 2 жыл бұрын
Your super most best trainer 😎
@varshachavan471
@varshachavan471 4 жыл бұрын
Very Useful content you have provided Thank you so much for making thiss video ...my concepts cleared about hashmap
@meghatiwari5225
@meghatiwari5225 4 жыл бұрын
Thank you so much for very good way explained this topic with logic. It’s really helpful for anyone who wants to learn java. Thanks again.
@shaktimaan693
@shaktimaan693 4 жыл бұрын
it was epic moment when u explained about hash collision got gussbump . thak u sir
@satyaranjanpatra4380
@satyaranjanpatra4380 4 жыл бұрын
Your teaching style is very excellent
@ShadowWalker683
@ShadowWalker683 3 жыл бұрын
You have no idea how this video helped me. I have seen a bunch of other videos and the tutorials just make the concept much more complex. Thanks a bunch man! Keep up the good work.
@aniketbudbadkar1801
@aniketbudbadkar1801 Жыл бұрын
Gr8 explained keep it up and also share java8 new features related videos
@ramesh22kvr
@ramesh22kvr 4 жыл бұрын
i am following every video of yours
@mdnadimarif
@mdnadimarif 4 жыл бұрын
It's amazing way of explaining things. Big thumbs up
@pratapk.c1277
@pratapk.c1277 3 жыл бұрын
I was asked this question yesterday on interview and now i am watching it
@MicroServiceMan
@MicroServiceMan 5 жыл бұрын
At end u told map.put("null",4) but it should be map.put(null,4) ... Means without double quotes.... Otherwise it will become string
@ramesh22kvr
@ramesh22kvr 4 жыл бұрын
you are explaining very very good manner sir
@sudhirpadhy2492
@sudhirpadhy2492 3 жыл бұрын
Nice one !! Thanks Abhilash ..
@shreyasoni6223
@shreyasoni6223 3 жыл бұрын
Awesome explanation ... Thanks a lot!!
@deepchand517
@deepchand517 3 ай бұрын
By this I got concept internal working hashmao thank you
@SuruchiJaiswall
@SuruchiJaiswall 4 жыл бұрын
Superb explanation 🙏
@SanjeevSingh-bo7em
@SanjeevSingh-bo7em 3 жыл бұрын
doing great work keep doing it.
@SriHariChukka1210
@SriHariChukka1210 2 жыл бұрын
Great explanation 🙂
@marghe174.
@marghe174. 3 жыл бұрын
Finally I understood how is working
@ramesh22kvr
@ramesh22kvr 4 жыл бұрын
finally found very good channel.thank you sir
@shwetasarangale1591
@shwetasarangale1591 5 жыл бұрын
Very useful.Thanks a lot for such a wonderful and simple explanation
@asemreddy1867
@asemreddy1867 3 жыл бұрын
Nice explanation.. Thank you ..!
@rajatgoyal1491
@rajatgoyal1491 5 жыл бұрын
Nice briefing over internal implementation of HashMap
@kurabhakalyani740
@kurabhakalyani740 4 жыл бұрын
Your way of talking is super i love it nice explanation
@tindo0038
@tindo0038 4 жыл бұрын
Nice explanation. THanks
@narendarb7308
@narendarb7308 5 жыл бұрын
Wow, it's amazing experience , now I understand that what exactly it is working internally..superb🙏
@pujabansal810
@pujabansal810 5 жыл бұрын
I was never able to understand this topic. After watching your videos concepts are very cleared
@subhojitdas1727
@subhojitdas1727 4 жыл бұрын
Explained in a plain simple easily understandable way. Really helpful. Thank you!!
@psudhakarreddy6548
@psudhakarreddy6548 3 жыл бұрын
Good 👍
@Kajal_Kumari_Ojha
@Kajal_Kumari_Ojha 5 жыл бұрын
I feel in the 6th node ...linked list of 1st will store the address of the next linked list and the address of the last LinkedList will be null as u have explained. Anyways Superb Explanation.
@HardikPatel-iw7ju
@HardikPatel-iw7ju 5 жыл бұрын
Nice video for interview point of view.
@MinalShewale
@MinalShewale 3 жыл бұрын
i did not understand much...but i liked the way you explained...
@sivaranjanis8605
@sivaranjanis8605 6 жыл бұрын
Superb explanation, It's really very useful Thank you
@22890074
@22890074 3 жыл бұрын
It's a nice video. Better to add how it checks if we added a duplicate key in the put method
@prasadp6474
@prasadp6474 6 жыл бұрын
Superb. Seriously your explanations are so good. Please publish more concepts.
@markokafor7432
@markokafor7432 4 жыл бұрын
Access to a linked list is only through the head. The second value will be placed at the head while the first value will be pushed to the new node. so your first node should contain aab and the second should be aaa. That is how insertion works in linked list. You have it the other way around
@jayakumar6091
@jayakumar6091 5 жыл бұрын
Simple and very straight forward 😍😘
@asthagarg4614
@asthagarg4614 3 жыл бұрын
Amazing video but I think you should also explain about 'rehashing' also. I have always watched this video for understanding the internal working of Hashmap but interviewer asked me about how Hashmap grows and I was unable to answer that question in detail.
@johnwilson3918
@johnwilson3918 7 жыл бұрын
The 'hash(key) & (n - 1)' statement is a quicker equivalent to 'hash(key) % n' ; but with the caveat that the bucket size (n) is a power of 2 (ie. 2, 4, 8, 16, 32, 64, 128, 256 ....). If you convert each member of the latter set to binary and subtract one and peek at the binary bit pattern - you'll see why '&' works as 'MODULUS' in these instances.
@Rithus2020
@Rithus2020 3 жыл бұрын
Hi You did an execellent job.Crystal clear.Thanks for the video!
@kraju8760
@kraju8760 5 жыл бұрын
Good sir.its very helpful to beginners.Thank u
@studymathematics3297
@studymathematics3297 6 жыл бұрын
Bro superbly explained, You have cleared my doubts Please make a video on inheritance and explain all such posssible cases like Parent p = new child() Child c = new parent() Parent p = new parent() Child c = new child()
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Thanks, bhai..Glad you find it helpful. hope this video can help : kzbin.info/www/bejne/rKGZfpaumJZ2iq8 have a nice time !!
@javabava6928
@javabava6928 6 жыл бұрын
Study Mathematics Child c=new Parent(); not possible because child class reference cannot hold parent class object. It will give compile time error.
@ricardotrejoruiz5776
@ricardotrejoruiz5776 3 жыл бұрын
For those who doesn't get what "hashcode & (n-1)" does is a simple logic and againts the binary value of 15 who is 1111. So this always will return a number between 0 and 15 and is the fast way to do it ;) So doesn't matter which value has the hascode for values greatter than 15, will allways do a logic AND againts zero.
@mansijain8092
@mansijain8092 3 жыл бұрын
Thank you so much for very good explanation. It is very helpful. Now could you please upload the vedio of hashset internal working?
@rajesh_mohantabandhuzim1569
@rajesh_mohantabandhuzim1569 5 жыл бұрын
Outstanding
@manva007
@manva007 6 жыл бұрын
thanks for sharing this video, while you are explaining collision, 2 different keys would never have the same hashcode, but they are doing mod operation same bucket number could come, and it would result into collision , it would be worth explaining the get operation, modules operation and also load factor
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Thanks Manish pointing these things out.. I have covered all the things in the follow up tutorials that you wanted me to cover.
@joyateechattopadhyay9510
@joyateechattopadhyay9510 4 жыл бұрын
nice explanation
@deviprasadpatnaik6837
@deviprasadpatnaik6837 6 жыл бұрын
Awesome explanation abhilash bhai
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Thanks bhai 👍
@sowmyarajendran4829
@sowmyarajendran4829 5 жыл бұрын
Thanks for the video.. Got this question in my thought works interview and got cleared
@dalbirsinghdhillon1429
@dalbirsinghdhillon1429 3 жыл бұрын
good explanation.. in the case of the same hashcode, a linked list is created..containing same hashcode in each node of the LL.. first of all, it's same hashcode for each node and secondly, we can calculate this hashcode using key so why store it in each node.
@puru22cool
@puru22cool 6 жыл бұрын
good work..but instead of creating new linkedlist in case of hash collision , it just create a new node in the existing linkedlist and add the new element in it. Please correct this.
@harshinredzone
@harshinredzone 5 жыл бұрын
Perhaps that depends on algorithm you use to implement hashmap
@KidJV
@KidJV 5 жыл бұрын
correct, in his context he meant new node and also shows in his drawing but is saying creating new linkedlist.
@musamammadov4984
@musamammadov4984 3 жыл бұрын
Thank you for your effort.
@manishgupta5740
@manishgupta5740 3 жыл бұрын
well explained
@ARI-em6me
@ARI-em6me 5 жыл бұрын
Super way of teaching
@suchimn477
@suchimn477 6 жыл бұрын
first of all thank you bro,good explanation of internal mechanism ,if we have null key then what will be happen? And if I have the requirement like LinkedHashMap then how it will be stored internally?will you explain this mechanism.And one more thing don't be think negative.. the way of your explanation is good and the way of your looking is awesome(handsome) ...
@MuzaffarUmarjonov-v4l
@MuzaffarUmarjonov-v4l Жыл бұрын
superb bro
@pranjaliwagh4900
@pranjaliwagh4900 6 жыл бұрын
Great tutorial... appreciate your work...thank you..
@devulechutalks
@devulechutalks 3 жыл бұрын
Nice class
@akware977
@akware977 5 жыл бұрын
Thank you so much to clear the question deeply in simple words
@siddhantjaiswal3077
@siddhantjaiswal3077 6 жыл бұрын
Nice explanation sir😊
@priyankashinde1424
@priyankashinde1424 6 жыл бұрын
Thank you so much for explaining very well please keep it on your videos for another's concepts and practicals of java it will really help us.
@MegaSethi
@MegaSethi 4 жыл бұрын
Great explanation!!
@Ishnavvulu
@Ishnavvulu 6 жыл бұрын
Hi. I am glad that found your tutotial.It was very unique that providing and explaining with debugging so that the logically can understand the point.It was very nice.But please do the titorial on Threads ,Serilization please.
@goonerritz93
@goonerritz93 5 жыл бұрын
Very well explained! Thanks!
@SonalGupta25
@SonalGupta25 6 жыл бұрын
Awesome Explanation!! just loved it..
@itisksn
@itisksn 4 жыл бұрын
nice explanation, love it!!
@archigoel4717
@archigoel4717 6 жыл бұрын
Thanks for explaining. This is a very common interview question.
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Thanks for watching !!
@asad_mirza
@asad_mirza 4 жыл бұрын
Thankyou for this video
@bharathan1608
@bharathan1608 6 жыл бұрын
Awesome video.. Salute to ur effort.. Now i clearly learnt about hashmap.. Thank u very much. Make more videos bro.
@yanamalaram3919
@yanamalaram3919 5 жыл бұрын
Super explanation
@भारत-झ7छ
@भारत-झ7छ 6 жыл бұрын
OSM Explaination Bro.......
@yeshwanthln7621
@yeshwanthln7621 3 жыл бұрын
will different strings can create the same hash code, according to my knowledge new hash code might be created and we would get the same index by modulo operation.
@pawankpk8301
@pawankpk8301 6 жыл бұрын
very good explanation bro..
@swapsure
@swapsure 6 жыл бұрын
Explanation is apt !! Kudos !!
@pranayjakku9621
@pranayjakku9621 6 жыл бұрын
Boss I am big fan of u.bcz of u only I am learning some depth knowledge in java..cou ld you plus explain the excat difference between comparator and comparabale..tree set by default wt it is? Comparator how customized method
@ZenOfKursat
@ZenOfKursat 6 жыл бұрын
nice teacher. everyone can learn but cannot be a teacher
@shivananadotari3572
@shivananadotari3572 6 жыл бұрын
Great..!!! Very Nice Explanation
@SeleniumExpress
@SeleniumExpress 6 жыл бұрын
Thank you
@amoghkashyap9341
@amoghkashyap9341 4 жыл бұрын
After hash function and some modular operation the index which it will generate always ranges from 0to15?
@santoshkumarsahoo1103
@santoshkumarsahoo1103 6 жыл бұрын
A great one.... Please make a video on Hibernate bootstraping 3.x,4.x and 5.x.... with internal explanation and with example...
@rajkoli8150
@rajkoli8150 5 жыл бұрын
Nice
[PRACTICAL]How Hashmap works internally || Debugging || part 2
23:35
Selenium Express
Рет қаралды 167 М.
01. Internal Working of HashMap & Java-8 Enhancement
19:11
Ankit Wasankar
Рет қаралды 128 М.
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
How I Build Any Website Feature With NO CODE EXPERIENCE
12:50
Income stream surfers
Рет қаралды 1,7 М.
How HashMap works in Java? With Animation!! whats new in java8 tutorial
15:29
Ranjith ramachandran
Рет қаралды 1 МЛН
How the get(Key k) method works within a HashMap|| Part 3
6:56
Selenium Express
Рет қаралды 86 М.
Map and HashMap in Java with Internal Working- Interview Question
19:27
Daily Code Buffer
Рет қаралды 31 М.
Interview Question | Comparable vs Comparator in Java
12:58
Telusko
Рет қаралды 650 М.