Computers and Technology

PYTHON ORDERED HASHTABLE I'm having touble with the following assignment and implementation of an array-backed ordered hashtable in python.
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
h[k] = v If h does not contain key k, a new k?v mapping is added, else the value for key k is updated to v.
h[k] If h contains key k, the corresponding value is returned, else a KeyError is raised.
del h[k] 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 ordering purposes).
k in h Returns True if key k is in h.
len(h) Returns the number of keys in h.
iter(h) Returns an iterator over all the keys in h, in the order they were added.
h. keys() (Same as above)
h. values() Returns an iterator over all the values in h, in the order they were added.
h. items() 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 (i. e., in __init__); your implementation must heed this value, as there may be performance ramifications if it does not.
In [ ]:

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:30, tfornwalt4390
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
image
Computers and Technology, 23.06.2019 01:20, sosick90501
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
image
Computers and Technology, 23.06.2019 03:30, 890777
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, ranmmm
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
Do you know the correct answer?
PYTHON ORDERED HASHTABLE I'm having touble with the following assignment and implementation of an a...

Questions in other subjects:

Konu
Mathematics, 27.04.2021 19:40
Konu
Mathematics, 27.04.2021 19:40
Konu
Mathematics, 27.04.2021 19:40