Join Raghavendra Dixit for an in-depth discussion in this video Introduction, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] In this chapter, we will learn about Hash Tables. Hash Tables are data structures with are create for very fast insertion and retrieval data almost in constant time. You can imagine that the data structure looks something like this. It's just a collection of key end value players. The keys need not be just numbers. They can be any type of object. Similarly, value can also be any object that we would like to store corresponding to a key.
This value is known as satellite data. Think about a bakery which has these kind of regular items. And for each item and also the size, it may have created some kind of pin identifier. Let's say it's just a number, for simplicity. And if the records for all these items were to be stored in a computer, one may choose to use a Hash Tables table structure to store these records.
As you can see, an item contains information about which item it is, its size, and its price. So if a billing application was written, it will be very fast to access these records by the key, which is the ID of the item. Similarly, if we want to store users, we may choose to use their email addresses as the key, which will be of string type. And the value can be the corresponding user object.
But how is it that we can access the values using the keys in constant time? Think about another data structure which gives us constant time insertion and retrieval of data. It is the added data structure which lets us do that. If we know the index of the element, then inserting and reading data at that index is a constant time operation, isn't it? So the trick is to use add is as an underlying data structure.
But the issue is that we can only use integer as keys because add in indexes are integers. So let's see how a Hash Tables is designed, such that it is able to put any type of object as a key. So let's start with direct access tables.
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.