Hash Maps

What is a hashmap?

How to know when to use this data structure?

Rudimentary understanding


Collision reduction

Load factor

Hash Map signature

class HashMap:
	# Initializes an emtpy hash map.
	def __init__(self):

	# Given a key, will return the value associated with that key if it’s in the table. 
	# This function will return None if the key is not in the hash map. 
	# O(1) runtime.
	def get(self, key): 

	# Inserts the key-value pair into the hashmap. 
	# If the key already exists it will overwrite the previous value with the new value. 
	# O(1) runtime.
	def put(self, key, value):

	# Returns true if it contains the key. 
	# O(1) runtime.
	def contains(self, key):

	# Private function to compute an integer hash value for a given key. 
	# O(1) runtime.
	def _hash(self, key):