   nodes: null
   length: 0
   constructor: (options)->
-    if !options?
-      options = {}
-    @nodes = options.nodes || []
-    @heapify()
+    #if !options?
+      #options = {}
+    #@nodes = options.nodes || []
+    #@heapify()
+    @nodes = []
 
   pop: ()->
     if @length > 0

    if content
      length = @length++
      nodes = @nodes
      nodes[length] = 
        content: content
        value: value
      @bubbleUp(length)

  update: (content, value)->
    if content?
      nodes = @nodes
      for i, node of nodes
        if content == node.content
          break

      swap = node
      nodes[i] = nodes[0]
      nodes[0] = swap
      swap.value = value

      sift = 0

        lesser = if nodes[left].value > nodes[right].value then right else left
        if node.value > nodes[lesser].value
          nodes[i] = nodes[lesser]
          nodes[i].index = i
          nodes[lesser] = node
          nodes[lesser].index = lesser
          return lesser
      else if node.value > nodes[left].value
        nodes[i] = nodes[left]
        nodes[i].index = i
        nodes[left] = node
        nodes[left].index = left
        return left
    return null

#  heapify: ()->
#    for i in [0..@nodes.length-1]
#      @siftDown(i)

module.exports = Heap