How are HashMaps implemented in Java? Internal Working Explained With Code | IMP Interview Question

preview_player
Показать описание

0:00 - Introduction
0:40 - Contents of the video
1:30 - Why do we need a HashMap data structure?
5:15 - Calculate frequencies using a simple array.
7:50 - Problems with the above approach.
8:50 - Using Bucket Array
11:00 - Introducing Hashing and Hash Function?
13:15 - Compression Function
18:07 - Hash Collision
21:15 - Closed Hashing/Separate Chaining
23:51 - Open Addressing
24:56 - Implementing HashMaps in Java [ CODE]
40:53 - Time Complexity of our Code
43:45 - Rehashing
48:00 - Implementing Rehashing in our code
50:15 - Testing our HashMap
50:34 - Ramping Up.

Tags
#hashmap
#java #javaprogramming #riddhiduttajava #javadeveloper #javadevelopment #javatutorial #spring #backenddeveloper #multithreadinginjava #multithreading #concurrency #javaconcurrency#backendwebdevelopment #collections #collectionframework
java concurrency
volatile keyword
singleton design pattern
java concurrency and multithreading
java multithreading tutorial
java multithreading interview questions
java multithreading project
multithreading in java
multithreading interview questions in java
multithreading in os
java threads tutorial
java thread life cycle
java thread synchronization
java thread interview questions
java concurrency tutorial
java collection framework
java collection framework course
java collection framework crash course
java tutorial for beginners
java full course
how to learn java
java developer
java developer interview
java developer roadmap
java developer course
java developer work in company
java developer interview questions
java developer salary
java developer jobs for freshers
java developer interview questions for freshers
java developer skills needed
java developer interview questions for 2 years experience
java developer full course
java developer roadmap 2022
java developer salary in india
java developer roadmap 2023
java in programming language
java in project
java projects
java projects for beginners
java programming
java programming for beginners
java programming full course
java programs for practice
java projects with source code
java interview questions and answers
how to learn spring boot step by step
how to learn spring framework in java
how to learn spring
how to learn spring boot
dependency injection spring boot
@configuration in spring boot
how to learn spring boot from scratch
how to learn spring framework
java backend development tutorial
java backend
java backend developer
java backend projects
java backend developer full course
java backend tutorial
java backend developer interview questions
java backend roadmap
Рекомендации по теме
Комментарии
Автор

Hey Ridhi, I watched your Collection Framework and Multithreading videos before 1 week of my interview and I am very happy to tell you that I got selected out of 10 candidates to that company for Java profile. Your teaching style is just so awesome. Please keep on posting new videos brother.

May God give you all the happiness 💝🙏🏻

animeshjaiswal
Автор

Excellent explanation without any kind of repetition. Great content on YouTube.

shankar
Автор

Finally, Master Java is back on youtube. Good See you

Anilkumar-reddy
Автор

❤❤ if you ask me i must day while watching the full video your explanation did not feel like I’m watching via YouTube. ❤❤ i feel like we are directly interacting.


Super Riddhi da ✨. More this type of titbits we need . Kudos

sounishnath
Автор

Really the best explanation ever on hashmap implementation ❤👍

ketansarode
Автор

Amazing explaining and kudos for your deep knowledge and expertise.

TheBikerDude
Автор

Good explanation with code much intuitive

dayashankarlakhotia
Автор

Worth watching your videos 💯..but shocked to see very less views . Do keep posting more videos on java

Kavya-
Автор

It's a good video. Didn't find such content.

ayushsingh
Автор

great video Riddhi, but just to point out the hashcode function does not give the memory address of the object.

HamzaKhan-wikb
Автор

Hi riddhi it was really great explanation but there is small change in code need to wrap Math.abs(key.hashCode()). there can be negative hashcode and negative numbers will give the error while getting the index of the table(bucket)

Hitesh-qo
Автор

I haven't seen any explanation on Hashmap that has this much depth.
But It would have been even better if you discussed the worst case time complexity under high hash collisions would be O(n) in this linked list implementation and it can be reduced to O(log n) using balanced BST.

Can you please discuss in a separate video about this Balanced BST implementation when the treeify_threshold has been crossed ??

prateek
Автор

Hi Riddhi,

Can you also talk about why you were not using this keyword to set/update the values. Example this.size=0,

factnoted
Автор

1hr back only done this problem using the hashmap. It takes lot of memory size than nested for loop to find number of occurrences of an element . Basically i from non it which one should I prefer space complexity or time complexity to design the alogorothm

thimothipalipaka
Автор

A great explanation Riddhi. Thanks for explaining in such deep, as it is very important to know about load factor and initial capacity. We can also provide a constructor which takes initial capacity and load factor arguments also right? as it's done in the default HashMap class.Again, thanks for your effort

sankarapuvishnuvardhan
Автор

Great explanation. I have got a different level of clarity in internal working of Hashmap. But I still have one doubt regarding the reduction in collisions. Suppose, the load factor crossed the threshold and we doubled the bucket array size and rehashing is also done but now also only the bucket index is going to change because of the change in compression function but for the objects which had same bucket index before rehashing, they will still be having the same bucket index just at a different index now.

So, after rehashing, how does Hash fucntion will reduce the collisions??

rohitsriwastav
Автор

Sir make a full playlist of spring and spring boot

SnehansuPradhan
Автор

I need advice m fresher struggling to get a entry job using java stack
What i want to know is shud i be doing advance topics of java the ones u teach seems little advance or i should stick to core and only practice that

accforgame
Автор

Hi sir currently I am working as a flutter developer in Renault Nissan
And I am preparing more DSA for top product based company can you please tell will my tech stack i.e flutter will be reliable for companies like faang please sir

karanjitsinghrandhawa
Автор

Your voice is getting resound i thought that was due to your room....can you pls resolve it if possible....

kp-cjro