Course Solutions Uncategorized (Solved) : Implement Map Python Using Sorted List Entries Keep Entry List Sorted Key Times Make Use B Q28401945 . . . .

(Solved) : Implement Map Python Using Sorted List Entries Keep Entry List Sorted Key Times Make Use B Q28401945 . . . .

 

Implement a map in PYTHON using a sorted list of entries. Youshould keep the entry list sorted by key at alltimes, and make use of the binary search routine included in thescaffold to speed up key lookups.

The binary search function is : def binary_search(self,key):
min = 0
max = len(self._entries)
while min < max:
mid = int((max + min)/2)
mid_key = self._entries[mid].get_key()
if mid_key == key:
return mid
elif mid_key < key:
min = mid + 1
else:
max = mid
# not found
return -1

the functions we need to implement using this are:

containsKey(k)

: Returns true if there exists an entry with key k in the map,false otherwise.

get(k)

: If the map contains an

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post