Join Raghavendra Dixit for an in-depth discussion in this video Resolving collisions through chaining, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] One of the ways to resolve collisions…can be not to insert the data directly into the array slot.…Rather, we can use a list,…a linked list kind of data structure for each slot.…So even if multiple keys map to the same slot,…the records can be stored as a linked list.…Here, each record contains the key,…as well as the satellite data in a node of a linked list.…So if the hash function h,…when applied to keys K2 and K3,…evaluate to a single integer value i,…we can store the data associated with keys K2 and K3…as a linked list at the same array index i.…
So this method of resolving collisions…is called the method of chaining.…Now what would be the worst-case time complexity…of finding the item if we use chaining?…Think about what will happen in the worst case.…Well, in the worst case,…all the keys may map to a single slot, right?…That is, when we hash any key,…we get the same value of the index…where the record should be inserted.…So all the records have been stored…in one single linked list.…
So if you have to find the record…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Why study data structures and algorithms?
- How to calculate the time complexity
- Using Big O notation
- Using basic sorting and search algorithms
- Searching elements in unordered arrays and ordered arrays
- Implementing a linked list in Java
- Implementing stacks using arrays
- Queues using arrays
- Binary search trees
- Representing heaps using arrays
Skill Level Intermediate
1. Introduction to Algorithms
2. Analysis of Algorithms
3. Basic Sorting and Search Algorithms
4. Linked Lists
5. Stacks and Queues
7. Binary Search Trees
8. More Sorting Algorithms
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.