def add(selfkeyvalue)"""add key-value pair ""token self locator(keyvaluelen(self data)initiaize locator index self data append(tokenself upheap(len(self data return token def update(selflocnewkeynewval)"""update the key and value for the entry identified by locator loc "" loc index if not ( < len(selfand self data[jis loc)raise valueerrorinvalid locator loc key newkey loc value newval self bubble(jdef remove(selfloc)"""remove and return the ( ,vpair identified by locator loc "" loc index if not ( < len(selfand self data[jis loc)raise valueerrorinvalid locator if =len(self item at last position just remove it self data popelseswap item to the last position self swap(jlen(self)- remove it from the list self data popfix item displaced by the swap self bubble(jreturn (loc keyloc valuecode fragment an implementation of an adaptable priority queue (continued from code fragment operation running time len( ) is empty) mino( add( ,vo(log ) update(lockvo(log np remove(loco(log ) remove mino(log )amortized with dynamic array table running times of the methods of an adaptable priority queuepof size nrealized by means of our array-based heap representation the space requirement is (