# Since 'heapq' is only available with Python 2.3 and above, this file can
# be used for earlier versions.
#
# Right now, the implemementation just keeps calling sort() on the list to
# fake it.  May or may not be worth it to actually implement the binary heap
# algorithm.

def heapify(heap):
   heap.sort()

def heappop(heap):
   if (len(heap) < 1):
      raise IndexError, "pop from empty list"
   item = heap[0]
   heap.remove(item)
   return item

def heappush(heap, item):
   heap.append(item)
   heap.sort()

