title
Collision Handling In Hash Table - Data Structures & Algorithms Tutorials In Python #6
description
Collisions in hash table can be handled using separate chaining or linear probing (also known as open addressing or closed hashing). We will cover these two techniques in this tutorial and then implement hash table class in python using separate chaining. Hash map or hash table is a very popular data structure. It allows to store key, value pairs and using key you can locate a value in O(1) or constant time.
Code: https://github.com/codebasics/data-structures-algorithms-python/tree/master/data_structures/4_HashTable_2_Collisions/4_hash_table_collision_handling.ipynb
Exercise: https://github.com/codebasics/data-structures-algorithms-python/tree/master/data_structures/4_HashTable_2_Collisions/4_hash_table_exercise.md
Topics
00:00 Introduction
00:33 Separate chaining
02:37 Linear probing
03:42 Implement chaining in python
15:38 Exercise
Do you want to learn technology from me? Check https://codebasics.io/ for my affordable video courses.
#datastructures #algorithms #python #HashTable #HashTablealgorithms
Next Video: https://www.youtube.com/watch?v=zwb3GmNAtFk&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=7
Previous video: https://www.youtube.com/watch?v=ea8BRGxGmlA&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=5
Complete playlist:https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12
Website: https://codebasics.io/
Facebook: https://www.facebook.com/codebasicshub
Twitter: https://twitter.com/codebasicshub
detail
{'title': 'Collision Handling In Hash Table - Data Structures & Algorithms Tutorials In Python #6', 'heatmap': [{'end': 174.395, 'start': 148.252, 'weight': 0.832}, {'end': 335.302, 'start': 299.851, 'weight': 0.719}, {'end': 485.043, 'start': 380.868, 'weight': 0.722}, {'end': 595.369, 'start': 569.135, 'weight': 0.703}], 'summary': 'This tutorial series on collision handling in hash tables in python covers methods like separate chaining and linear probing, resolving collisions and implementing hash table operations, with examples and illustrations emphasizing the importance of good hashing functions and the use of linear probing for collision resolution.', 'chapters': [{'end': 198.538, 'segs': [{'end': 47.311, 'src': 'embed', 'start': 0.589, 'weight': 0, 'content': [{'end': 6.871, 'text': 'In this data structure tutorial, we are going to look into how to handle collisions in hash table.', 'start': 0.589, 'duration': 6.282}, {'end': 16.414, 'text': 'In part one video, which if you have not seen already, I highly recommend you watch it, we implemented hash table in Python.', 'start': 7.731, 'duration': 8.683}, {'end': 22.656, 'text': 'We are going to take that class and we are going to enhance it to handle collision using separate chaining method.', 'start': 16.474, 'duration': 6.182}, {'end': 29.538, 'text': "We'll also go over linear probing and in the end we have a couple of interesting exercises for you to solve.", 'start': 23.016, 'duration': 6.522}, {'end': 37.244, 'text': 'Here in this picture, I have a hash map where the key is, for example, March 6, and the value is 310.', 'start': 30.66, 'duration': 6.584}, {'end': 41.407, 'text': 'Using hash function, we are finding appropriate index into our array.', 'start': 37.244, 'duration': 4.163}, {'end': 47.311, 'text': 'For example, here for March 6, I have index 9, and that value gets stored here.', 'start': 41.827, 'duration': 5.484}], 'summary': 'Tutorial on handling hash table collisions with separate chaining and linear probing in python.', 'duration': 46.722, 'max_score': 0.589, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM589.jpg'}, {'end': 148.252, 'src': 'embed', 'start': 98.28, 'weight': 2, 'content': [{'end': 110.906, 'text': 'the big O analysis here will be that usually for average case, hashmap search complexity is order of one, which is a constant time.', 'start': 98.28, 'duration': 12.626}, {'end': 115.127, 'text': 'but in this case it might go up till order of n.', 'start': 110.906, 'duration': 4.221}, {'end': 124.233, 'text': 'because imagine, if you have a bad hashing function and all the elements, all the keys, generate same index,', 'start': 115.127, 'duration': 9.106}, {'end': 129.175, 'text': 'then you will have all of your values stuck in one bucket and this will be a long linked list.', 'start': 124.233, 'duration': 4.942}, {'end': 136.622, 'text': 'so in that case the search complexity is same as the complexity of a linked list, which is order of n and when?', 'start': 129.175, 'duration': 7.447}, {'end': 142.146, 'text': 'now I want to retrieve value of March 17 first, I use has function to get an index which is 9..', 'start': 136.622, 'duration': 5.524}, {'end': 148.252, 'text': 'I go to index number 9, then I linearly search this linked list,', 'start': 142.146, 'duration': 6.106}], 'summary': 'Hashmap search complexity can be o(1) but with bad hashing function, it can go up to o(n).', 'duration': 49.972, 'max_score': 98.28, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM98280.jpg'}, {'end': 174.395, 'src': 'heatmap', 'start': 148.252, 'weight': 0.832, 'content': [{'end': 158.6, 'text': 'and for that reason it is important to have your key stored in each of these elements so that you know which value is associated with which key.', 'start': 148.252, 'duration': 10.348}, {'end': 163.284, 'text': 'The second approach for solving the collision is called linear probing.', 'start': 159.001, 'duration': 4.283}, {'end': 174.395, 'text': 'Here. what we do is when, for March 17, we get an index 9 and we find that there is already a value stored at this location,', 'start': 164.125, 'duration': 10.27}], 'summary': 'Storing keys in each element is crucial to avoid collision. linear probing is used for resolving collisions.', 'duration': 26.143, 'max_score': 148.252, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM148252.jpg'}, {'end': 207.687, 'src': 'embed', 'start': 177.037, 'weight': 4, 'content': [{'end': 184.984, 'text': "Here my array is ending here, but let's say if there was a 10th location which was empty, then I would store March 17 at 10th location.", 'start': 177.037, 'duration': 7.947}, {'end': 188.227, 'text': "But since I don't have 10th location, I will go reverse.", 'start': 185.745, 'duration': 2.482}, {'end': 192.412, 'text': 'look at zeroth location, that location is also filled out.', 'start': 188.988, 'duration': 3.424}, {'end': 198.538, 'text': 'so then i go to location number one and here i store my mars 17 value.', 'start': 192.412, 'duration': 6.126}, {'end': 207.687, 'text': 'it is called linear probing, because i am linearly probing means searching for an empty slot to store my key value pair.', 'start': 198.538, 'duration': 9.149}], 'summary': 'Using linear probing to store key-value pairs in array, with a focus on handling empty slots and march 17 value.', 'duration': 30.65, 'max_score': 177.037, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM177037.jpg'}], 'start': 0.589, 'title': 'Hash table collisions', 'summary': 'Covers handling collisions in hash tables through separate chaining and linear probing methods, with examples and illustrations, and highlights the potential increase in search complexity due to bad hashing functions, emphasizing the importance of storing keys in each element and the use of linear probing for collision resolution.', 'chapters': [{'end': 97.225, 'start': 0.589, 'title': 'Handling collisions in hash table', 'summary': 'Discusses handling collisions in hash tables, covering separate chaining and linear probing methods, with examples and illustrations, and concludes with a set of exercises.', 'duration': 96.636, 'highlights': ['The chapter discusses handling collisions in hash tables, covering separate chaining and linear probing methods, with examples and illustrations.', 'The chapter emphasizes the use of separate chaining method to handle collisions, where a linked list or a list is stored at every location to accommodate multiple keys sharing the same hash value.', 'The chapter concludes with a set of exercises for practical application and understanding of the concepts.']}, {'end': 198.538, 'start': 98.28, 'title': 'Hashmap search complexity and collision resolution', 'summary': 'Discusses the potential increase in search complexity to order of n due to bad hashing functions, leading to all values being stuck in one bucket and causing a linear search, highlighting the importance of storing keys in each element and the use of linear probing for collision resolution.', 'duration': 100.258, 'highlights': ['The search complexity can increase to order of n due to a bad hashing function, resulting in all values being stuck in one bucket and causing a linear search, which is highlighted by considering the retrieval of a specific value.', 'It is important to store keys in each element to associate them with their respective values, emphasizing the necessity for efficient lookup.', 'Linear probing is a method to resolve collisions by finding the next available location to store the value, as demonstrated in the example of finding a location for March 17 in the array.']}], 'duration': 197.949, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM589.jpg', 'highlights': ['The chapter emphasizes the use of separate chaining method to handle collisions, where a linked list or a list is stored at every location to accommodate multiple keys sharing the same hash value.', 'The search complexity can increase to order of n due to a bad hashing function, resulting in all values being stuck in one bucket and causing a linear search, which is highlighted by considering the retrieval of a specific value.', 'It is important to store keys in each element to associate them with their respective values, emphasizing the necessity for efficient lookup.', 'Linear probing is a method to resolve collisions by finding the next available location to store the value, as demonstrated in the example of finding a location for March 17 in the array.', 'The chapter discusses handling collisions in hash tables, covering separate chaining and linear probing methods, with examples and illustrations.', 'The chapter concludes with a set of exercises for practical application and understanding of the concepts.']}, {'end': 517.107, 'segs': [{'end': 251.352, 'src': 'embed', 'start': 222.861, 'weight': 0, 'content': [{'end': 227.325, 'text': 'Here I have a Python class that we implemented in part 1 of this tutorial.', 'start': 222.861, 'duration': 4.464}, {'end': 229.467, 'text': 'And this class is not handling collision.', 'start': 227.545, 'duration': 1.922}, {'end': 238.069, 'text': 'All it is doing is Getting a hashing function and when you do get item or set item it will go to particular index in your array and store the value.', 'start': 229.647, 'duration': 8.422}, {'end': 241.07, 'text': 'I will show you what problem this class will have.', 'start': 238.089, 'duration': 2.981}, {'end': 251.352, 'text': 'So here I have get hash function being called for March 6 and March 17 and you know that they both have the same index.', 'start': 241.17, 'duration': 10.182}], 'summary': "Python class lacks collision handling, causing index conflict for 'march 6' and 'march 17'.", 'duration': 28.491, 'max_score': 222.861, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM222861.jpg'}, {'end': 335.302, 'src': 'heatmap', 'start': 299.851, 'weight': 0.719, 'content': [{'end': 308.794, 'text': 'So if you remember from our first presentation, we store key value pair whenever we have collision so that we can locate the right element.', 'start': 299.851, 'duration': 8.943}, {'end': 313.536, 'text': "That's why I'm having array in each individual element.", 'start': 309.194, 'duration': 4.342}, {'end': 315.556, 'text': 'The get hash function remains the same.', 'start': 313.896, 'duration': 1.66}, {'end': 317.517, 'text': "We don't need to change that.", 'start': 316.056, 'duration': 1.461}, {'end': 320.698, 'text': 'We are now going to implement setItem function.', 'start': 318.197, 'duration': 2.501}, {'end': 329.4, 'text': 'In our original implementation, we used to overwrite the value at index H, but at index H now we have a linked list.', 'start': 321.078, 'duration': 8.322}, {'end': 335.302, 'text': 'So we need to iterate through the linked list and find the right location to update our value.', 'start': 329.52, 'duration': 5.782}], 'summary': 'Hash table stores key value pairs, with collision resolution through linked lists. setitem function iterates through linked list to update value.', 'duration': 35.451, 'max_score': 299.851, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM299851.jpg'}, {'end': 372.76, 'src': 'embed', 'start': 342.987, 'weight': 3, 'content': [{'end': 350.85, 'text': 'So it could happen that you might already have March 6 in your location and you will be like okay, March 6,', 'start': 342.987, 'duration': 7.863}, {'end': 352.67, 'text': "let's update the value with something else.", 'start': 350.85, 'duration': 1.82}, {'end': 364.056, 'text': 'For example here If you have something like this, where initially you inserted mass 6, but then next time you want to update the same value,', 'start': 353.17, 'duration': 10.886}, {'end': 365.136, 'text': 'OK for that key.', 'start': 364.056, 'duration': 1.08}, {'end': 368.178, 'text': "So we're going to handle this particular case first.", 'start': 365.596, 'duration': 2.582}, {'end': 372.76, 'text': "So let's iterate through it.", 'start': 369.839, 'duration': 2.921}], 'summary': 'Handling the case of updating values for a specific key in an iterative process.', 'duration': 29.773, 'max_score': 342.987, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM342987.jpg'}, {'end': 485.043, 'src': 'heatmap', 'start': 380.868, 'weight': 0.722, 'content': [{'end': 386.01, 'text': 'or this particular key does not exist.', 'start': 380.868, 'duration': 5.142}, {'end': 391.792, 'text': 'in that case, what you will do is simply in that link list.', 'start': 386.01, 'duration': 5.782}, {'end': 402.315, 'text': 'so this, this particular thing, this one is a link list, or in python we are just using a list here you want to update key value pair.', 'start': 391.792, 'duration': 10.523}, {'end': 410.605, 'text': 'This will be a simple scenario, but that you will do it only if the key does not exist in that linked list.', 'start': 403.379, 'duration': 7.226}, {'end': 414.849, 'text': 'Hence, you want to first find out if key exists or not.', 'start': 411.706, 'duration': 3.143}, {'end': 415.649, 'text': 'All right.', 'start': 414.869, 'duration': 0.78}, {'end': 420.654, 'text': 'So you will say for index element in.', 'start': 415.689, 'duration': 4.965}, {'end': 427.96, 'text': 'So enumerate is a function you use to iterate through the elements in your array.', 'start': 421.594, 'duration': 6.366}, {'end': 444.935, 'text': 'and if the length of element is equal to 2 and element 0 is equal to key, which means for this key, I already have an element.', 'start': 429.805, 'duration': 15.13}, {'end': 447.897, 'text': 'so that element you just change a value.', 'start': 444.935, 'duration': 2.962}, {'end': 451.38, 'text': 'so in that same element you will change a value.', 'start': 447.897, 'duration': 3.483}, {'end': 456.285, 'text': 'but since we are inserting a tuple, tuples are immutable.', 'start': 451.38, 'duration': 4.905}, {'end': 463.169, 'text': 'so I cannot just say element one is equal to value.', 'start': 456.285, 'duration': 6.884}, {'end': 467.292, 'text': 'you know, instead of tuple, if you had used another array it might have worked.', 'start': 463.169, 'duration': 4.123}, {'end': 472.555, 'text': "so I'm just going to insert a new tuple, basically at the same location.", 'start': 467.292, 'duration': 5.263}, {'end': 485.043, 'text': 'so my location is first of all this and in that on that particular index i will store this key value location.', 'start': 472.555, 'duration': 12.488}], 'summary': 'Updating key-value pairs in a linked list or list using python, checking for key existence and handling tuple immutability.', 'duration': 104.175, 'max_score': 380.868, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM380868.jpg'}, {'end': 427.96, 'src': 'embed', 'start': 403.379, 'weight': 1, 'content': [{'end': 410.605, 'text': 'This will be a simple scenario, but that you will do it only if the key does not exist in that linked list.', 'start': 403.379, 'duration': 7.226}, {'end': 414.849, 'text': 'Hence, you want to first find out if key exists or not.', 'start': 411.706, 'duration': 3.143}, {'end': 415.649, 'text': 'All right.', 'start': 414.869, 'duration': 0.78}, {'end': 420.654, 'text': 'So you will say for index element in.', 'start': 415.689, 'duration': 4.965}, {'end': 427.96, 'text': 'So enumerate is a function you use to iterate through the elements in your array.', 'start': 421.594, 'duration': 6.366}], 'summary': 'Use enumerate to iterate through array elements to find if key exists in the linked list.', 'duration': 24.581, 'max_score': 403.379, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM403379.jpg'}, {'end': 517.107, 'src': 'embed', 'start': 487.805, 'weight': 2, 'content': [{'end': 497.853, 'text': "i would suggest you debug this in pycharm and when you step through the code you will get an exit idea of what i'm trying to do here,", 'start': 487.805, 'duration': 10.048}, {'end': 500.335, 'text': 'and this is found equal to true.', 'start': 497.853, 'duration': 2.482}, {'end': 508.22, 'text': 'so if that happens, uh, the found thing becomes true and you break out of the loop.', 'start': 500.335, 'duration': 7.885}, {'end': 510.062, 'text': 'okay, so let me break out of the loop.', 'start': 508.22, 'duration': 1.842}, {'end': 517.107, 'text': 'So found element is false initially.', 'start': 512.549, 'duration': 4.558}], 'summary': 'Using pycharm to debug code, found element becomes true, breaking out of loop.', 'duration': 29.302, 'max_score': 487.805, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM487805.jpg'}], 'start': 198.538, 'title': 'Handling collisions in python and hash functions', 'summary': 'Explains linear probing in python with an example demonstrating resolution after two failed attempts, and introduces chaining implementation. it also discusses hash function collisions, the need to handle them, and the use of a linked list to resolve collisions in the hash table.', 'chapters': [{'end': 241.07, 'start': 198.538, 'title': 'Handling collision in python', 'summary': 'Explains linear probing to handle collision in python, where an example demonstrates resolving to index 2 after two failed attempts, and then introduces the implementation of chaining in python.', 'duration': 42.532, 'highlights': ['The chapter explains linear probing for handling collision in Python, where an example demonstrates resolving to index 2 after two failed attempts.', 'The chapter introduces the implementation of chaining in Python, showcasing a class that does not handle collision effectively.']}, {'end': 517.107, 'start': 241.17, 'title': 'Handling hash function collisions', 'summary': 'Discusses the issue of hash function collisions, the need to handle collisions, and the implementation of a linked list to resolve collisions in the hash table.', 'duration': 275.937, 'highlights': ['The issue of hash function collisions is demonstrated by the example of overwriting values for different keys with the same index, leading to retrieval errors.', 'The need to handle collisions leads to the decision to initialize individual elements as empty arrays to store key-value pairs, preventing data overwriting.', 'The implementation of a linked list at index H in the hash table allows for the iteration through the list to find the right location to update a value, resolving the collision issue.']}], 'duration': 318.569, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM198538.jpg', 'highlights': ['The implementation of a linked list at index H in the hash table allows for the iteration through the list to find the right location to update a value, resolving the collision issue.', 'The need to handle collisions leads to the decision to initialize individual elements as empty arrays to store key-value pairs, preventing data overwriting.', 'The issue of hash function collisions is demonstrated by the example of overwriting values for different keys with the same index, leading to retrieval errors.', 'The chapter explains linear probing for handling collision in Python, where an example demonstrates resolving to index 2 after two failed attempts.', 'The chapter introduces the implementation of chaining in Python, showcasing a class that does not handle collision effectively.']}, {'end': 749.157, 'segs': [{'end': 595.369, 'src': 'heatmap', 'start': 557.025, 'weight': 0, 'content': [{'end': 561.529, 'text': "Now I'm gonna do let's say this.", 'start': 557.025, 'duration': 4.504}, {'end': 566.193, 'text': 'OK, so let me remove this two thing.', 'start': 562.87, 'duration': 3.323}, {'end': 569.075, 'text': 'So that one is gone.', 'start': 567.934, 'duration': 1.141}, {'end': 574.4, 'text': "So here I created hash table object and here I'm inserting couple of values.", 'start': 569.135, 'duration': 5.265}, {'end': 577.701, 'text': 'And in the previous implementation, March 6 was showing 4.59.', 'start': 575.14, 'duration': 2.561}, {'end': 579.162, 'text': "So let's see.", 'start': 577.701, 'duration': 1.461}, {'end': 581.763, 'text': 'So here this is working correct.', 'start': 579.782, 'duration': 1.981}, {'end': 584.624, 'text': "I mean, I don't have get item implemented.", 'start': 581.823, 'duration': 2.801}, {'end': 585.765, 'text': "That's why it showed like this.", 'start': 584.664, 'duration': 1.101}, {'end': 589.887, 'text': 'But you can see that at that location now it is storing a link list.', 'start': 586.145, 'duration': 3.742}, {'end': 595.369, 'text': 'If you want to get a better idea, you can just print this array.', 'start': 590.687, 'duration': 4.682}], 'summary': 'Implemented hash table with values, showing correct results.', 'duration': 28.74, 'max_score': 557.025, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM557025.jpg'}, {'end': 716.804, 'src': 'embed', 'start': 684.745, 'weight': 3, 'content': [{'end': 685.065, 'text': 'All right.', 'start': 684.745, 'duration': 0.32}, {'end': 686.545, 'text': 'So I want to say key.', 'start': 685.445, 'duration': 1.1}, {'end': 686.905, 'text': 'All right.', 'start': 686.685, 'duration': 0.22}, {'end': 688.906, 'text': 'So let me just change this to key.', 'start': 686.925, 'duration': 1.981}, {'end': 701.011, 'text': 'So for that key, which is mass 617, whatever, if that matches, you return element of one.', 'start': 690.267, 'duration': 10.744}, {'end': 706.273, 'text': 'See element zero is this key, which we are matching if it matches.', 'start': 701.891, 'duration': 4.382}, {'end': 710.615, 'text': 'Return the second part, which is the value itself.', 'start': 707.23, 'duration': 3.385}, {'end': 712.498, 'text': 'Alright, so this looks good.', 'start': 711.236, 'duration': 1.262}, {'end': 716.804, 'text': 'If it cannot find the value, then it will return none.', 'start': 713.259, 'duration': 3.545}], 'summary': "Matching key '617' returns value, else returns 'none'.", 'duration': 32.059, 'max_score': 684.745, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM684745.jpg'}], 'start': 519.423, 'title': 'Hash table operations and implementation', 'summary': 'Covers handling hash table operations such as inserting, modifying, and retrieving key-value pairs. it also explains the implementation of a hash table to store and retrieve specific values, demonstrating successful operations and iterations.', 'chapters': [{'end': 585.765, 'start': 519.423, 'title': 'Handling hash table operations', 'summary': 'Discusses handling hash table operations including inserting new key-value pairs, modifying existing pairs, and retrieving values. the example shows the successful insertion of key-value pairs into a hash table.', 'duration': 66.342, 'highlights': ['The example demonstrates inserting new key-value pairs into a hash table.', 'The chapter explains the handling of hash table operations including inserting and modifying key-value pairs.', 'The discussion covers the use of hash table operations to handle scenarios where keys already exist and need to be modified.']}, {'end': 749.157, 'start': 586.145, 'title': 'Hash table implementation', 'summary': 'Explains the implementation of a hash table to store key-value pairs, iterating through the elements to find the appropriate value, resulting in successful retrieval of values for specific keys.', 'duration': 163.012, 'highlights': ['The array at the specified index stores a linked list, where each element is a key-value pair, enabling efficient storage and retrieval of values for specific keys.', 'The get function iterates through the values in the index obtained from the hash, using a for loop to match the key and retrieve the corresponding value, showcasing successful retrieval of values for specific keys.', "The modified get function returns the value matching the key, and if no value is found, it returns 'none', resulting in successful retrieval of values for specific keys."]}], 'duration': 229.734, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM519423.jpg', 'highlights': ['The example demonstrates inserting new key-value pairs into a hash table.', 'The discussion covers the use of hash table operations to handle scenarios where keys already exist and need to be modified.', 'The chapter explains the handling of hash table operations including inserting and modifying key-value pairs.', 'The array at the specified index stores a linked list, where each element is a key-value pair, enabling efficient storage and retrieval of values for specific keys.', 'The get function iterates through the values in the index obtained from the hash, using a for loop to match the key and retrieve the corresponding value, showcasing successful retrieval of values for specific keys.', "The modified get function returns the value matching the key, and if no value is found, it returns 'none', resulting in successful retrieval of values for specific keys."]}, {'end': 1100.092, 'segs': [{'end': 812.96, 'src': 'embed', 'start': 781.954, 'weight': 0, 'content': [{'end': 793.931, 'text': 'and then for index key value in enumerate, enumerate what self dot array of edge?', 'start': 781.954, 'duration': 11.977}, {'end': 798.635, 'text': "because when you want to delete something, let's say you want to delete march 17..", 'start': 793.931, 'duration': 4.704}, {'end': 801.476, 'text': 'You first locate the index, which is number nine.', 'start': 798.635, 'duration': 2.841}, {'end': 802.897, 'text': 'So then you get this list.', 'start': 801.536, 'duration': 1.361}, {'end': 805.818, 'text': 'So this list is this particular thing.', 'start': 803.277, 'duration': 2.541}, {'end': 807.959, 'text': 'This is that list.', 'start': 806.438, 'duration': 1.521}, {'end': 811.28, 'text': 'Now you go through each of these elements in the list.', 'start': 808.839, 'duration': 2.441}, {'end': 812.96, 'text': "So I'm iterating this loop.", 'start': 811.32, 'duration': 1.64}], 'summary': 'Explaining the process of locating and deleting an element from a list using an index.', 'duration': 31.006, 'max_score': 781.954, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM781954.jpg'}, {'end': 914.097, 'src': 'embed', 'start': 875.624, 'weight': 4, 'content': [{'end': 879.105, 'text': 'so this executes this ctrl enter, ctrl enter.', 'start': 875.624, 'duration': 3.481}, {'end': 884.527, 'text': "I'm executing all of this and now let's say delete.", 'start': 879.105, 'duration': 5.422}, {'end': 890.589, 'text': 'I want to delete March 17.', 'start': 884.527, 'duration': 6.062}, {'end': 896.991, 'text': "Okay, it executed, fine, without any complaints, but let's see if it worked really.", 'start': 890.589, 'duration': 6.402}, {'end': 899.152, 'text': 'Voila, now this is working.', 'start': 897.512, 'duration': 1.64}, {'end': 902.093, 'text': 'See, March 6, March 17.', 'start': 899.192, 'duration': 2.901}, {'end': 906.515, 'text': 'You can also delete March 6 and see what happens.', 'start': 902.093, 'duration': 4.422}, {'end': 910.056, 'text': 'So March 6 here, control enter.', 'start': 906.555, 'duration': 3.501}, {'end': 914.097, 'text': 'And then t.array, t.array.', 'start': 912.577, 'duration': 1.52}], 'summary': 'Executing commands successfully to delete specific dates from the data.', 'duration': 38.473, 'max_score': 875.624, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM875624.jpg'}, {'end': 1030.711, 'src': 'embed', 'start': 1003.771, 'weight': 2, 'content': [{'end': 1015.121, 'text': 'okay. so go here and when you say clone or download, this way you can download the Entire repository with all my tutorials and in data structure.', 'start': 1003.771, 'duration': 11.35}, {'end': 1019.764, 'text': 'So if you go inside data structure, see I have all these different tutorials and.', 'start': 1015.161, 'duration': 4.603}, {'end': 1026.608, 'text': 'Hashtable collisions when you go here in the solution I have.', 'start': 1020.885, 'duration': 5.723}, {'end': 1030.711, 'text': 'The CSV file poem dot txt etc.', 'start': 1028.029, 'duration': 2.682}], 'summary': 'Download the entire repository with all tutorials and data structure content.', 'duration': 26.94, 'max_score': 1003.771, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM1003771.jpg'}], 'start': 749.217, 'title': 'Python hash table implementation', 'summary': 'Discusses the implementation of delete item function in a python hash table, providing a step-by-step explanation, and demonstrating successful deletion of key-value pairs, ensuring the functionality of the hash table.', 'chapters': [{'end': 939.059, 'start': 749.217, 'title': 'Python hash table implementation', 'summary': 'Discusses the implementation of delete item function in a python hash table, providing a step-by-step explanation of the process and demonstrating successful deletion of key-value pairs, ensuring the functionality of the hash table.', 'duration': 189.842, 'highlights': ['The implementation of the delete item function in the Python hash table is explained, detailing the process of locating and removing a specific key-value pair, ensuring the successful deletion of items.', "A step-by-step demonstration of the deletion process is provided, showcasing the removal of specific elements such as 'March 17' and 'March 6' from the hash table, verifying the functionality of the delete item function.", 'The hash table is confirmed to be working effectively through the successful deletion and retrieval of key-value pairs, ensuring the overall functionality of the implemented data structure.']}, {'end': 1100.092, 'start': 939.059, 'title': 'Exercise on hash table and importance of data structures', 'summary': 'Emphasizes the importance of working on exercises, provides guidance on accessing exercise solutions and csv files, and stresses the significance of understanding data structures for programming and data science interviews.', 'duration': 161.033, 'highlights': ['The importance of working on exercises and not just watching tutorials is emphasized, with a specific mention of a complex exercise on implementing linear probing in a hash table.', 'Guidance is provided on accessing solution links only after attempting the exercises and on downloading CSV files from the repository, with a demonstration of the process.', 'The significance of in-depth understanding of data structures for programming and data science interviews is stressed, highlighting its importance in the context of big O analysis.', 'The availability of exercise links, code, and useful information in the video description is mentioned, emphasizing the provision of additional resources for viewers.']}], 'duration': 350.875, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/54iv1si4YCM/pics/54iv1si4YCM749217.jpg', 'highlights': ['The hash table is confirmed to be working effectively through the successful deletion and retrieval of key-value pairs, ensuring the overall functionality of the implemented data structure.', "A step-by-step demonstration of the deletion process is provided, showcasing the removal of specific elements such as 'March 17' and 'March 6' from the hash table, verifying the functionality of the delete item function.", 'The implementation of the delete item function in the Python hash table is explained, detailing the process of locating and removing a specific key-value pair, ensuring the successful deletion of items.', 'The importance of working on exercises and not just watching tutorials is emphasized, with a specific mention of a complex exercise on implementing linear probing in a hash table.', 'The significance of in-depth understanding of data structures for programming and data science interviews is stressed, highlighting its importance in the context of big O analysis.', 'Guidance is provided on accessing solution links only after attempting the exercises and on downloading CSV files from the repository, with a demonstration of the process.', 'The availability of exercise links, code, and useful information in the video description is mentioned, emphasizing the provision of additional resources for viewers.']}], 'highlights': ['The chapter emphasizes the use of separate chaining method to handle collisions, where a linked list or a list is stored at every location to accommodate multiple keys sharing the same hash value.', 'The search complexity can increase to order of n due to a bad hashing function, resulting in all values being stuck in one bucket and causing a linear search, which is highlighted by considering the retrieval of a specific value.', 'The example demonstrates inserting new key-value pairs into a hash table.', 'The hash table is confirmed to be working effectively through the successful deletion and retrieval of key-value pairs, ensuring the overall functionality of the implemented data structure.']}