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
PayPal Gateway not configured
PayPal Gateway not configured