parameters: (self)
return_statement: return heap[0][1]
docstring: Find smallest item after removing deleted items from front of heap.
docstring_summary: Find smallest item after removing deleted items from front of heap.
docstring_tokens: Find smallest item after removing deleted items from front of heap .
function: def smallest(self):
          '''
          Find smallest item after removing deleted items from front of heap.
          '''
          if len(self) == 0:
              raise IndexError, "smallest of empty priorityDictionary"
          heap = self.__heap
          while heap[0][1] not in self or self[heap[0][1]] != heap[0][0]:
              lastItem = heap.pop()
              insertionPoint = 0
              while 1:
                  smallChild = 2*insertionPoint+1
                  if smallChild+1 < len(heap) and heap[smallChild] > heap[smallChild+1] :
                      smallChild += 1
                  if smallChild >= len(heap) or lastItem <= heap[smallChild]:
                      heap[insertionPoint] = lastItem
                      break
                  heap[insertionPoint] = heap[smallChild]
                  insertionPoint = smallChild
          return heap[0][1]
function_tokens: def smallest ( self ) : if len ( self ) == 0 : raise IndexError , "smallest of empty priorityDictionary" heap = self . __heap while heap [ 0 ] [ 1 ] not in self or self [ heap [ 0 ] [ 1 ] ] != heap [ 0 ] [ 0 ] : lastItem = heap . pop ( ) insertionPoint = 0 while 1 : smallChild = 2 * insertionPoint + 1 if smallChild + 1 < len ( heap ) and heap [ smallChild ] > heap [ smallChild + 1 ] : smallChild += 1 if smallChild >= len ( heap ) or lastItem <= heap [ smallChild ] : heap [ insertionPoint ] = lastItem break heap [ insertionPoint ] = heap [ smallChild ] insertionPoint = smallChild return heap [ 0 ] [ 1 ]