Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the class HashMap with a hash table data structure, using an indexable collection (array or python list that can retrieve a value at a

Implement the class HashMap with a hash table data structure, using an indexable collection (array or python list that can retrieve a value at a given index in 0(1) time) of Bucket The class must fully implement the Map ADT, including the following operations insert(key, data) Adds this value pair to the collection o If equal key is already in the collection, raise ItemExistsException) o . update(key, data) o Sets the data value of the value pair with equal key to data o If equal key is not in the collection, raise NotFoundException0 * find(key) o Returns the data value of the value pair with equal key o If equal key is not in the collection, raise NotFoundException0 o Returns True if equal key is found in the collection, otherwise False o Removes the value pair with equal key from the collection . contains(key) * remove(key) o If equal key is not in the collection, raise NotFoundException0 o Override to allow this syntax o If equal key is already in the collection, update its data value o setitem (self, key, data) some hash map[key]- data Otherwise add the value pair to the collection * _getitem_(self, key) o Override to allow this syntax my_data-some_hash_map[key] o Returns the data value of the value pair with equal key o If equal key is not in the collection, raise NotFoundException0) o Override to allow this syntax o Returns the number of items in the ene data structure . len (self) length_of_structurelen(some_hash map) When the number of items in the HashMap has reached 120% of the number of buckets (length of array or list) it must rebuild(), doubling the number of buckets

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions