Data Structures in Python: Hash Table

Scroll down to bottom to checkout previous tutorials

Hash Table is a type of data structure where the address of data elements .i.e indices of data elements are generated via a hash function. In Hash Table, elements are stored as key-value pairs but the key is generated through a hash function. This makes accessing data faster as index value behaves as a key for the data value.

stock_prices = {
'march 6': 310,
'march 7': 340,
'march 8': 380,
'march 17': 440,
}
  1. Chaining
  2. Linear Probing

Chaining

In chaining, we append a tuple of key-value pairs at the same index to overcome collision

Linear Probing

In linear probing instead of appending to the same location, it will search for another available free location and store there

Lectures

Lecture 1: https://medium.com/@saifmdco/data-structures-with-python-introduction-4dadeffa2215

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store