title
Hash Table - Data Structures & Algorithms Tutorials In Python #5
description
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. We will implement simple hash table in python in this tutorial and in part 2 we will see how to handle collisions.
Code: https://github.com/codebasics/data-structures-algorithms-python/tree/master/data_structures/4_HashTable/4_HashTable.ipynb
Topics
00:00 Introduction
00:34 Array vs hashmap Scenario
03:52 Memory presentation (array vs hashmap)
04:15 Hash function
07:09 Big O Analysis
07:17 Hashmap in Python/JAVA/C++
07:47 Implement Hash Table in python
#HashTable #HashMap #hashmappython #datastructures #algorithms #python
Do you want to learn technology from me? Check https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description for my affordable video courses.
Next Video: https://www.youtube.com/watch?v=54iv1si4YCM&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=6
Previous video: https://www.youtube.com/watch?v=qp8u-frRAnU&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=4
Complete playlist:https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12
🌎 My Website For Video Courses: https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description
Need help building software or data analytics and AI solutions? My company https://www.atliq.com/ can help. Click on the Contact button on that website.
#️⃣ Social Media #️⃣
🔗 Discord: https://discord.gg/r42Kbuk
📸 Dhaval's Personal Instagram: https://www.instagram.com/dhavalsays/
📸 Codebasics Instagram: https://www.instagram.com/codebasicshub/
🔊 Facebook: https://www.facebook.com/codebasicshub
📱 Twitter: https://twitter.com/codebasicshub
📝 Linkedin (Personal): https://www.linkedin.com/in/dhavalsays/
📝 Linkedin (Codebasics): https://www.linkedin.com/company/codebasics/
🔗 Patreon: https://www.patreon.com/codebasics?fan_landing=true
detail
{'title': 'Hash Table - Data Structures & Algorithms Tutorials In Python #5', 'heatmap': [], 'summary': 'Tutorial on hash tables in python covers efficient data structures for stock prices, data storage efficiency, hash table implementation, and implementing hash tables in python, emphasizing improved time complexity and efficiency with examples and complexities.', 'chapters': [{'end': 204.063, 'segs': [{'end': 48.778, 'src': 'embed', 'start': 0.129, 'weight': 0, 'content': [{'end': 3.31, 'text': 'We are going to cover hash table in two videos.', 'start': 0.129, 'duration': 3.181}, {'end': 10.433, 'text': "In the first video, which is this video, we'll be looking at what is hash table, the different big O complexities,", 'start': 3.97, 'duration': 6.463}, {'end': 13.274, 'text': 'and we will implement hash table in Python.', 'start': 10.433, 'duration': 2.841}, {'end': 19.376, 'text': 'In the second video we will look at how to handle collisions using chaining and linear probem,', 'start': 13.754, 'duration': 5.622}, {'end': 22.837, 'text': "and we'll do the implementation of those two different approaches.", 'start': 19.376, 'duration': 3.461}, {'end': 27.04, 'text': 'At the end of the second video we will also have an interesting exercise for you.', 'start': 23.177, 'duration': 3.863}, {'end': 33.866, 'text': 'So make sure you watch both the videos and most importantly you do exercises at the end of video number two.', 'start': 27.18, 'duration': 6.686}, {'end': 43.173, 'text': "Let's say you have stock prices data coming into this CSV file and here you have a date and the price of the stock on a given day.", 'start': 34.726, 'duration': 8.447}, {'end': 48.778, 'text': 'You want to write a program which can give you the price based on a day.', 'start': 43.814, 'duration': 4.964}], 'summary': 'Covering hash table in two videos, implementing in python, handling collisions with chaining and linear probem, and an exercise at the end of the second video.', 'duration': 48.649, 'max_score': 0.129, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA129.jpg'}, {'end': 171.752, 'src': 'embed', 'start': 76.027, 'weight': 1, 'content': [{'end': 88.006, 'text': 'It is a two-dimensional array or a list where each of the element is another list where the zeroth element in that sublist is the day and the first element is the price.', 'start': 76.027, 'duration': 11.979}, {'end': 101.64, 'text': "Now, if you want to know what was the price on, let's say, March 9, then you can write a simple for loop saying for element in stock prices.", 'start': 89.031, 'duration': 12.609}, {'end': 111.326, 'text': 'If element zero is equal to March 9, then you have found your element.', 'start': 102.981, 'duration': 8.345}, {'end': 115.389, 'text': 'So print element one.', 'start': 111.847, 'duration': 3.542}, {'end': 121.442, 'text': 'So this program tells you that on March 9, the price was 302.', 'start': 117.199, 'duration': 4.243}, {'end': 128.888, 'text': "While using a list works here, but it is not very efficient, because imagine if your file size is, let's say,", 'start': 121.442, 'duration': 7.446}, {'end': 137.054, 'text': 'million records and the date that you are looking at is towards the end, then you have to run those many iterations.', 'start': 128.888, 'duration': 8.166}, {'end': 141.117, 'text': 'So the complexity of this program is order of n.', 'start': 137.114, 'duration': 4.003}, {'end': 146.542, 'text': 'To find a price based on a day, it is order of n complexity.', 'start': 141.117, 'duration': 5.425}, {'end': 158.43, 'text': 'In Python there is dictionary which can do the same thing in order of one which is a constant time operation and let me show you how you can do that.', 'start': 147.522, 'duration': 10.908}, {'end': 158.991, 'text': 'So here.', 'start': 158.53, 'duration': 0.461}, {'end': 168.97, 'text': "I'm going to copy the same code and one change I'm making is replacing a list with a dictionary.", 'start': 160.222, 'duration': 8.748}, {'end': 171.752, 'text': 'So my stock prices is a dictionary now.', 'start': 169.51, 'duration': 2.242}], 'summary': 'Using a dictionary for stock prices retrieval results in constant time complexity, unlike the list approach which has a time complexity of order n.', 'duration': 95.725, 'max_score': 76.027, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA76027.jpg'}], 'start': 0.129, 'title': 'Efficient data structures for stock prices', 'summary': 'Covers hash table implementation, two-dimensional array usage, and python dictionary efficiency for stock prices data, emphasizing improved time complexity and efficiency with examples and complexities.', 'chapters': [{'end': 73.218, 'start': 0.129, 'title': 'Hash table overview and implementation', 'summary': 'Covers hash table, big o complexities, and hash table implementation in python, with a later focus on handling collisions using chaining and linear probem; concluding with an exercise involving stock prices data.', 'duration': 73.089, 'highlights': ['The chapter explains the concept of hash table and its implementation in Python, covering big O complexities (O(1) for average case and O(n) for worst case).', 'The chapter also discusses handling collisions using chaining and linear probem, and concludes with an exercise involving stock prices data.', 'The exercise at the end of the second video is specifically highlighted, emphasizing the importance of watching both videos and completing the exercises, reinforcing the practical application of the concepts learned.']}, {'end': 141.117, 'start': 76.027, 'title': 'Two-dimensional array for stock prices', 'summary': 'Discusses using a two-dimensional array or list to store stock prices, with a sample program to find the price on a specific date, highlighting its inefficiency for large datasets with a complexity of o(n).', 'duration': 65.09, 'highlights': ['Using a two-dimensional array or list to store stock prices, with a sample program to find the price on a specific date', 'Highlighting the inefficiency of using a list for large datasets and the resulting complexity of O(n)']}, {'end': 204.063, 'start': 141.117, 'title': 'Python dictionary for efficient price lookup', 'summary': 'Demonstrates how using a dictionary in python can provide constant time complexity for price lookup, as opposed to the order of n complexity when using a list, effectively improving efficiency and speed.', 'duration': 62.946, 'highlights': ['Using a dictionary in Python provides a constant time (order of one) complexity for price lookup, enhancing efficiency and speed.', 'Replacing a list with a dictionary for price lookup improves the time complexity from order of n to constant time.']}], 'duration': 203.934, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA129.jpg', 'highlights': ['Covers hash table implementation, two-dimensional array usage, and python dictionary efficiency for stock prices data, emphasizing improved time complexity and efficiency with examples and complexities.', 'Using a dictionary in Python provides a constant time (order of one) complexity for price lookup, enhancing efficiency and speed.', 'Replacing a list with a dictionary for price lookup improves the time complexity from order of n to constant time.', 'The chapter explains the concept of hash table and its implementation in Python, covering big O complexities (O(1) for average case and O(n) for worst case).', 'The chapter also discusses handling collisions using chaining and linear probem, and concludes with an exercise involving stock prices data.', 'Using a two-dimensional array or list to store stock prices, with a sample program to find the price on a specific date', 'Highlighting the inefficiency of using a list for large datasets and the resulting complexity of O(n)', 'The exercise at the end of the second video is specifically highlighted, emphasizing the importance of watching both videos and completing the exercises, reinforcing the practical application of the concepts learned.']}, {'end': 412.574, 'segs': [{'end': 309.205, 'src': 'embed', 'start': 204.063, 'weight': 0, 'content': [{'end': 213.809, 'text': 'so you can compare array and a dictionary here and you can see that in this particular case, using dictionary makes more sense,', 'start': 204.063, 'duration': 9.746}, {'end': 216.911, 'text': 'because this operation is order of one.', 'start': 213.809, 'duration': 3.102}, {'end': 221.374, 'text': 'now we are going to look into internal implementation of a dictionary.', 'start': 216.911, 'duration': 4.463}, {'end': 224.575, 'text': 'So dictionary implements hash table.', 'start': 221.974, 'duration': 2.601}, {'end': 226.796, 'text': 'So hash table is the underlying data structure.', 'start': 224.595, 'duration': 2.201}, {'end': 233.339, 'text': 'And we will see how you can get order of one complexity for this search operation.', 'start': 227.316, 'duration': 6.023}, {'end': 241.562, 'text': 'When you store your data as two-dimensional list in the memory, it will store something like this where the first element is your day,', 'start': 233.719, 'duration': 7.843}, {'end': 244.043, 'text': 'then the second element is your price, and so on.', 'start': 241.562, 'duration': 2.481}, {'end': 248.225, 'text': 'So these are like contiguous memory locations on your RAM.', 'start': 244.863, 'duration': 3.362}, {'end': 260.928, 'text': "When you use dictionary on the other hand the way it will store this thing in RAM is First let's say it will allocate a list of some size.", 'start': 249.365, 'duration': 11.563}, {'end': 266.689, 'text': "Let's say a size of 10, and then it takes March 6 first.", 'start': 260.968, 'duration': 5.721}, {'end': 283.615, 'text': 'Somehow, it will map March 6 to a specific element in the list And to get the index of the element in that particular list you use hash function and we will see what this has function is later on.', 'start': 266.689, 'duration': 16.926}, {'end': 288.019, 'text': 'but all the hash function is doing is converting your string key.', 'start': 283.615, 'duration': 4.404}, {'end': 290.62, 'text': 'into an index, into an array.', 'start': 288.659, 'duration': 1.961}, {'end': 300.343, 'text': 'similarly, you can apply hash function for all other keys find out an index into an array and store those elements at that index.', 'start': 290.62, 'duration': 9.723}, {'end': 302.143, 'text': 'so it is that simple, okay.', 'start': 300.343, 'duration': 1.8}, {'end': 307.345, 'text': 'so if you think about it, if you have an array, usually you use integer index correct.', 'start': 302.143, 'duration': 5.202}, {'end': 309.205, 'text': "so let's say this is my array.", 'start': 307.345, 'duration': 1.86}], 'summary': 'Using a dictionary for storage results in o(1) complexity and utilizes a hash table for efficient search operations.', 'duration': 105.142, 'max_score': 204.063, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA204063.jpg'}, {'end': 419.378, 'src': 'embed', 'start': 390.006, 'weight': 5, 'content': [{'end': 393.647, 'text': 'you all know from the mathematics that you can do mode operation.', 'start': 390.006, 'duration': 3.641}, {'end': 401.91, 'text': 'Mode operation is nothing but you are dividing 609 with 10 and the remainder that you get, which is 9, is your mode.', 'start': 393.907, 'duration': 8.003}, {'end': 405.851, 'text': 'So this is how you generate a 9 from March 6th.', 'start': 402.77, 'duration': 3.081}, {'end': 410.453, 'text': 'as i said before, you can use different type of hash function.', 'start': 406.391, 'duration': 4.062}, {'end': 412.574, 'text': 'i just use this particular hash function.', 'start': 410.453, 'duration': 2.121}, {'end': 419.378, 'text': 'okay, so here in the hash map, uh, lookup by key is order of one on average.', 'start': 412.574, 'duration': 6.804}], 'summary': 'Mode operation generates 9 from 609 divided by 10. hash map lookup by key is order of one on average.', 'duration': 29.372, 'max_score': 390.006, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA390006.jpg'}], 'start': 204.063, 'title': 'Data storage efficiency', 'summary': "Covers the advantages of using a dictionary over an array, highlighting the order of one complexity for search operations and the underlying hash table implementation, along with explaining the concept of hash function, its application in hash table, and a specific example showing how 'march 6' is converted into the index 9 using the hash function and mode operation.", 'chapters': [{'end': 283.615, 'start': 204.063, 'title': 'Dictionary vs array: order of one complexity', 'summary': 'Explains the advantages of using a dictionary over an array, highlighting the order of one complexity for search operations and the underlying hash table implementation, offering a more efficient storage of data in ram.', 'duration': 79.552, 'highlights': ['The dictionary implementation uses a hash table, allowing for order of one complexity for search operations, providing efficient data retrieval.', 'Storing data as a two-dimensional list in memory results in contiguous memory locations on RAM, contrasting with the allocation and mapping process used by dictionaries for more efficient memory usage.', 'The chapter discusses how dictionaries allocate a list of a specific size and use a hash function to map elements, providing insights into the efficient storage of data in RAM.']}, {'end': 412.574, 'start': 283.615, 'title': 'Hash function and hash table', 'summary': "Explains the concept of hash function, using ascii numbers to implement it, and its application in hash table to convert string keys into indices, with a specific example showing how 'march 6' is converted into the index 9 using the hash function and mode operation.", 'duration': 128.959, 'highlights': ['Hash function is used to convert string keys into indices in a hash table, allowing the use of string indices in the hash map. The chapter explains the concept of hash function, using ASCII numbers to implement it, and its application in hash table to convert string keys into indices.', 'Using ASCII numbers to implement the hash function by finding the ASCII value for each letter in the key and summing them up to generate an index. The hash function uses ASCII numbers to find the ASCII value for each letter in the key, summing them up, and then using mode operation to get the index.', "Illustrating the specific example of converting 'March 6' into the index 9 using the hash function and mode operation. A specific example is provided to demonstrate the process of using the hash function and mode operation to convert 'March 6' into the index 9."]}], 'duration': 208.511, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA204063.jpg', 'highlights': ['The dictionary implementation uses a hash table, allowing for order of one complexity for search operations, providing efficient data retrieval.', 'Hash function is used to convert string keys into indices in a hash table, allowing the use of string indices in the hash map.', 'Storing data as a two-dimensional list in memory results in contiguous memory locations on RAM, contrasting with the allocation and mapping process used by dictionaries for more efficient memory usage.', 'The chapter discusses how dictionaries allocate a list of a specific size and use a hash function to map elements, providing insights into the efficient storage of data in RAM.', 'Using ASCII numbers to implement the hash function by finding the ASCII value for each letter in the key and summing them up to generate an index.', "Illustrating the specific example of converting 'March 6' into the index 9 using the hash function and mode operation."]}, {'end': 521.114, 'segs': [{'end': 495.46, 'src': 'embed', 'start': 412.574, 'weight': 0, 'content': [{'end': 419.378, 'text': 'okay, so here in the hash map, uh, lookup by key is order of one on average.', 'start': 412.574, 'duration': 6.804}, {'end': 428.423, 'text': "similarly, insertion and deletion is also order of one bigger complexity on average, and we'll go into this into detail as well.", 'start': 419.378, 'duration': 9.045}, {'end': 436.447, 'text': 'So this is an average complexity, but on a worst case it might be more than order of one.', 'start': 428.863, 'duration': 7.584}, {'end': 443.371, 'text': 'Here I have a list of classes available in different programming languages to implement hash table.', 'start': 436.667, 'duration': 6.704}, {'end': 446.733, 'text': 'In Python, the hash table implementation is called dictionary.', 'start': 443.871, 'duration': 2.862}, {'end': 448.114, 'text': 'Here is a code example.', 'start': 446.793, 'duration': 1.321}, {'end': 453.239, 'text': 'In Java, you have two classes, HashMap and LinkedHashMap.', 'start': 448.994, 'duration': 4.245}, {'end': 457.484, 'text': 'And this is how you create HashMap and LinkedHashMap.', 'start': 454.02, 'duration': 3.464}, {'end': 459.566, 'text': 'If you want to look at the differences, you can Google it.', 'start': 457.544, 'duration': 2.022}, {'end': 461.348, 'text': "I'm not going to go in detail on that.", 'start': 459.586, 'duration': 1.762}, {'end': 464.011, 'text': 'In C++, it is called std map.', 'start': 461.989, 'duration': 2.022}, {'end': 466.794, 'text': "So now let's implement HashMap in Python.", 'start': 464.371, 'duration': 2.423}, {'end': 471.175, 'text': 'first step of implementing hash table is writing your hash function.', 'start': 467.094, 'duration': 4.081}, {'end': 478.416, 'text': 'so here i have written the same hash function which i showed you in a presentation, which will take a key, which is a string,', 'start': 471.175, 'duration': 7.241}, {'end': 486.818, 'text': 'and it goes through each of the characters and this odd function will just find an ascii value for that character.', 'start': 478.416, 'duration': 8.402}, {'end': 490.519, 'text': 'for example, we saw that m was 109.', 'start': 486.818, 'duration': 3.701}, {'end': 495.46, 'text': 'so if you do odd of m, you get 109 right.', 'start': 490.519, 'duration': 4.941}], 'summary': 'Hash map offers o(1) average complexity; python uses dictionary, java has hashmap and linkedhashmap, c++ uses std map.', 'duration': 82.886, 'max_score': 412.574, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA412574.jpg'}], 'start': 412.574, 'title': 'Hash table implementation', 'summary': 'Discusses the average time complexity of hash map operations like lookup, insertion, and deletion, along with the different classes available in python, java, and c++ for hash table implementation.', 'chapters': [{'end': 521.114, 'start': 412.574, 'title': 'Hash table implementation overview', 'summary': 'Discusses the average time complexity of hash map operations like lookup, insertion, and deletion, along with the different classes available in python, java, and c++ for hash table implementation.', 'duration': 108.54, 'highlights': ['The average time complexity of hash map operations like lookup, insertion, and deletion is order of one, with the possibility of a worst case scenario being more than order of one.', "Python's hash table implementation is called a dictionary, Java has HashMap and LinkedHashMap, and in C++ it is called std map.", 'The hash function for implementing a hash table involves finding the ASCII value of each character in the key string, summing them up, and then performing a modulo operation using a chosen size, such as 100 in this case.']}], 'duration': 108.54, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA412574.jpg', 'highlights': ['The average time complexity of hash map operations like lookup, insertion, and deletion is order of one, with the possibility of a worst case scenario being more than order of one.', "Python's hash table implementation is called a dictionary, Java has HashMap and LinkedHashMap, and in C++ it is called std map.", 'The hash function for implementing a hash table involves finding the ASCII value of each character in the key string, summing them up, and then performing a modulo operation using a chosen size, such as 100 in this case.']}, {'end': 1069.811, 'segs': [{'end': 570.563, 'src': 'embed', 'start': 521.114, 'weight': 0, 'content': [{'end': 532, 'text': "okay. so what happens is when you call this function get hash on your key, which is, let's say, march 6, you get, uh, this type of value.", 'start': 521.114, 'duration': 10.886}, {'end': 539.984, 'text': 'okay. so you can do, uh, different keys and you will get different hash values to implement hash table.', 'start': 532, 'duration': 7.984}, {'end': 542.426, 'text': "i'm going to create a class in python now.", 'start': 539.984, 'duration': 2.442}, {'end': 546.688, 'text': "if you don't know how to create class in python, then you can watch my python tutorials.", 'start': 542.426, 'duration': 4.262}, {'end': 552.231, 'text': "i have tutorials on classes, list, dictionary and so on, so i'm assuming you have those concepts clear.", 'start': 546.688, 'duration': 5.543}, {'end': 559.596, 'text': 'okay, I created a hash table class where I have this array whose size is 100..', 'start': 552.231, 'duration': 7.365}, {'end': 564.179, 'text': "And I'm initializing 100 elements in this array using list comprehension here.", 'start': 559.596, 'duration': 4.583}, {'end': 566.18, 'text': 'This is how you do list comprehension.', 'start': 564.599, 'duration': 1.581}, {'end': 570.563, 'text': 'And the value in each of these elements is none.', 'start': 567.081, 'duration': 3.482}], 'summary': 'Creating a hash table class in python with 100 elements initialized using list comprehension.', 'duration': 49.449, 'max_score': 521.114, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA521114.jpg'}, {'end': 636.929, 'src': 'embed', 'start': 605.017, 'weight': 2, 'content': [{'end': 608.178, 'text': 'OK, so so far this looks good.', 'start': 605.017, 'duration': 3.161}, {'end': 616.1, 'text': 'Now we want to implement a function which can add an item into a hash map and get an item from the hash map.', 'start': 608.498, 'duration': 7.602}, {'end': 625.543, 'text': 'OK, so if you look at our stock prices example, we have day and we have a price you want to add the day and price.', 'start': 616.28, 'duration': 9.263}, {'end': 627.244, 'text': 'So it is like key value pair.', 'start': 625.783, 'duration': 1.461}, {'end': 628.944, 'text': 'So you want to add a key value pair.', 'start': 627.264, 'duration': 1.68}, {'end': 629.505, 'text': 'All right.', 'start': 629.184, 'duration': 0.321}, {'end': 636.929, 'text': 'So for that reason I will define a function called add so key and value.', 'start': 629.925, 'duration': 7.004}], 'summary': 'Implement function to add and get items in hash map', 'duration': 31.912, 'max_score': 605.017, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA605017.jpg'}, {'end': 969.482, 'src': 'embed', 'start': 941.421, 'weight': 3, 'content': [{'end': 952.425, 'text': 'But by writing this class you get understanding of how dictionary works internally and you get a better idea on how hash table works as a data structure.', 'start': 941.421, 'duration': 11.004}, {'end': 955.768, 'text': 'You can also define a delete item function.', 'start': 952.625, 'duration': 3.143}, {'end': 962.755, 'text': "So here you can have underscore, underscore, let's see what is that function.", 'start': 955.928, 'duration': 6.827}, {'end': 966.519, 'text': 'So delete item, yeah, this function, see, delete item.', 'start': 962.815, 'duration': 3.704}, {'end': 969.482, 'text': 'So these are all standard Python operators.', 'start': 967, 'duration': 2.482}], 'summary': 'Learn how dictionaries and hash tables work internally with python operators.', 'duration': 28.061, 'max_score': 941.421, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA941421.jpg'}, {'end': 1060.631, 'src': 'embed', 'start': 1033.848, 'weight': 5, 'content': [{'end': 1038.252, 'text': 'okay, great, so we just implemented hash table using python.', 'start': 1033.848, 'duration': 4.404}, {'end': 1041.194, 'text': 'now this is not handling collisions.', 'start': 1038.252, 'duration': 2.942}, {'end': 1049.542, 'text': 'collisions is a very important concept that you need to know when you are working with hash hash table,', 'start': 1041.194, 'duration': 8.348}, {'end': 1052.384, 'text': 'and that is something we are going to cover in the next video.', 'start': 1049.542, 'duration': 2.842}, {'end': 1055.327, 'text': 'so make sure you watch part two of this video.', 'start': 1052.384, 'duration': 2.943}, {'end': 1057.609, 'text': 'if you like this, give it a thumbs up.', 'start': 1055.327, 'duration': 2.282}, {'end': 1060.631, 'text': 'but yeah, this class is not handling collisions.', 'start': 1057.609, 'duration': 3.022}], 'summary': 'Implemented hash table in python, but not handling collisions yet.', 'duration': 26.783, 'max_score': 1033.848, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA1033848.jpg'}], 'start': 521.114, 'title': 'Implementing hash table in python', 'summary': "Explains the implementation of a hash table in python with a hash function for unique key values, an array of size 100, and list comprehension for 'none' value assignment. it also covers addition, retrieval, and deletion of key-value pairs with examples.", 'chapters': [{'end': 570.563, 'start': 521.114, 'title': 'Implementing hash table in python', 'summary': "Explains how to implement a hash table in python using a hash function to generate unique values for different keys, initializing a class with an array of size 100, and using list comprehension to assign 'none' values to the elements.", 'duration': 49.449, 'highlights': ['The chapter explains how to implement a hash table in Python using a hash function to generate unique values for different keys.', "Initializing a class with an array of size 100 and assigning 'none' values to the elements using list comprehension.", 'The speaker assumes that the audience has clear concepts on classes, lists, and dictionaries, and directs them to watch Python tutorials if needed.']}, {'end': 1069.811, 'start': 570.723, 'title': 'Implementing hash table in python', 'summary': 'Covers the implementation of a hash map in python, demonstrating the creation of a hash function, addition, retrieval, and deletion of key-value pairs within the hash map, with examples and explanations provided for each step.', 'duration': 499.088, 'highlights': ['The implementation demonstrates the creation of a hash function, addition, retrieval, and deletion of key-value pairs within the hash map.', 'The code examples show the usage of the hash map class in Python, using functions such as add, get, and delete item.', 'The tutorial emphasizes the importance of handling collisions in hash tables and hints at the coverage of this topic in the next video.']}], 'duration': 548.697, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ea8BRGxGmlA/pics/ea8BRGxGmlA521114.jpg', 'highlights': ['The chapter explains how to implement a hash table in Python using a hash function to generate unique values for different keys.', "Initializing a class with an array of size 100 and assigning 'none' values to the elements using list comprehension.", 'The implementation demonstrates the creation of a hash function, addition, retrieval, and deletion of key-value pairs within the hash map.', 'The code examples show the usage of the hash map class in Python, using functions such as add, get, and delete item.', 'The speaker assumes that the audience has clear concepts on classes, lists, and dictionaries, and directs them to watch Python tutorials if needed.', 'The tutorial emphasizes the importance of handling collisions in hash tables and hints at the coverage of this topic in the next video.']}], 'highlights': ['Using a dictionary in Python provides a constant time (order of one) complexity for price lookup, enhancing efficiency and speed.', 'The dictionary implementation uses a hash table, allowing for order of one complexity for search operations, providing efficient data retrieval.', 'The average time complexity of hash map operations like lookup, insertion, and deletion is order of one, with the possibility of a worst case scenario being more than order of one.', 'The chapter explains how to implement a hash table in Python using a hash function to generate unique values for different keys.']}