Question: ^This is the assignement overview. This code is written all in python. ^This is the code that was given to me. ^These are all the

 ^This is the assignement overview. This code is written all in

^This is the assignement overview. This code is written all in python.

python. ^This is the code that was given to me. ^These are

^This is the code that was given to me.

all the functions that I need to fill out. I did __getitem__

^These are all the functions that I need to fill out. I did __getitem__ and __setitem__, but I am not sure if it is right. I do not know how to do the rest. I am having a bit of trouble understanding hasntables.

Ordered Hashtable Overview For this assignment you will update and complete the implementation of the hashtable data structure presented in class, which exposes an API mirroring that of the built-in Python dict.When iterating over its contents (supported by the iter_ , keys, values , and items methods), your updated implementation will also reflect the order in which key/value pairs were originally inserted into the hashtable. This will require that you implement the two-tiered list system described during lecture The operations you will implement are listed alongside their descriptions below ( h refers to a hashtable): Operation Description If h does not contain key k, a new k - v mapping is added, else the value for key k is updated to v If h contains key k,the corresponding value is returned, else a KeyError is raised If h contains key k , it is removed along with its value, else a KeyError is raised. Note that if k is re-inserted at some later point it is considered a new key (for h[kv h[k] del h[k ordering purposes) Returns True if key k is in h Returns the number of keys in h k in h len (h) iter(h) h.keys() h.values () h.items () Returns an iterator over all the keys in h , in the order they were added. Same as above) Returns an iterator over all the values in h , in the order they were added. Returns an iterator over all the key/value pairs (as tuples) in h , in the order they were added. Your hashtable will be provided with the initial number of buckets on creation l.., in- performance ramifications if it does not. init- ; your implementation must heed this value, as there may be Ordered Hashtable Overview For this assignment you will update and complete the implementation of the hashtable data structure presented in class, which exposes an API mirroring that of the built-in Python dict.When iterating over its contents (supported by the iter_ , keys, values , and items methods), your updated implementation will also reflect the order in which key/value pairs were originally inserted into the hashtable. This will require that you implement the two-tiered list system described during lecture The operations you will implement are listed alongside their descriptions below ( h refers to a hashtable): Operation Description If h does not contain key k, a new k - v mapping is added, else the value for key k is updated to v If h contains key k,the corresponding value is returned, else a KeyError is raised If h contains key k , it is removed along with its value, else a KeyError is raised. Note that if k is re-inserted at some later point it is considered a new key (for h[kv h[k] del h[k ordering purposes) Returns True if key k is in h Returns the number of keys in h k in h len (h) iter(h) h.keys() h.values () h.items () Returns an iterator over all the keys in h , in the order they were added. Same as above) Returns an iterator over all the values in h , in the order they were added. Returns an iterator over all the key/value pairs (as tuples) in h , in the order they were added. Your hashtable will be provided with the initial number of buckets on creation l.., in- performance ramifications if it does not. init- ; your implementation must heed this value, as there may be

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 Databases Questions!