ride the remove min method because the only change in behavior for the adaptable priority queue is again provided by the overridden swap method the update and remove methods provide the core new functionality for the adaptable priority queue we perform robust checking of the validity of locator that is sent by caller (although in the interest of spaceour displayed code does not do preliminary type-checking to ensure that the parameter is indeed locator instanceto ensure that locator is associated with current element of the given priority queuewe examine the index that is encapsulated within the locator objectand then verify that the entry of the list at that index is the very same locator in conclusionthe adaptable priority queue provides the same asymptotic efficiency and space usage as the nonadaptive versionand provides logarithmic performance for the new locator-based update and remove methods summary of the performance is given in table class adaptableheappriorityqueue(heappriorityqueue) """ locator-based priority queue implemented with binary heap "" nested locator class class locator(heappriorityqueue item) """token for locating an entry of the priority queue ""slots _index add index as additional field def init (selfkvj) superinit ( , self index nonpublic behaviors override swap to record new indices def swap(selfij)perform the swap superswap( ,jreset locator index (post-swap self data[iindex reset locator index (post-swap self data[jindex def bubble(selfj) if and self data[jself data[self parent( )] self upheap( else self downheap(jcode fragment an implementation of an adaptable priority queue (continued in code fragment this extends the heappriorityqueue class of code fragments and