Question: I have a question on python data structures implementing the MAP advanced data structure. https://runestone.academy/runestone/books/published/pythonds3/SortSearch/Hashing.html shows a sample implementation of a hashtable that can help

I have a question on python data structures implementing the MAP advanced data structure.

https://runestone.academy/runestone/books/published/pythonds3/SortSearch/Hashing.html shows a sample implementation of a hashtable that can help implement this

The description of the functions to be implemented are here

I have a question on python data structures implementing the MAP advanced

1. init_() . Initialize HashMap object of size size_init (16 by default). The object contains _size , a list of _keys , and a list of values. 2. _setitem_(key, value) . Alias to put . Add (if key is not in the collection) a value to the collection. o Update (if key is already in the collection) a value in the collection. Raise a MemoryError exception if the table is full (a suitable position cannot be found after (_size attempts). 3. _getitem_(key) . Return a value by the key or None if the provided key is not in the collection. Alias to get. 4. _len_() . Return the number of key-value pairs stored in the collection. Not to be confused with _size (a fixed value). 5. _contains_ . Return True for a statement of the form key in map , if the given key is in the collection, False otherwise. 6. _str_. Return string representation of the collection. Example: {1: 'ant' , 2: 'bee' } 7. _hash(key, size) . Return key modulo size . 8. _rehash . Implement quadratic probing as a rehash technique. 9. keys () . Returns all keys in the map as a list. 10. values () . Returns all values in the map as a list. 11. items ( ) . Returns all non-empty (key, value) tuples in the map as a list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!