/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['collections/MaxHeap.js']) {
  _$jscoverage['collections/MaxHeap.js'] = [];
  _$jscoverage['collections/MaxHeap.js'][1] = 0;
  _$jscoverage['collections/MaxHeap.js'][20] = 0;
  _$jscoverage['collections/MaxHeap.js'][25] = 0;
  _$jscoverage['collections/MaxHeap.js'][26] = 0;
  _$jscoverage['collections/MaxHeap.js'][27] = 0;
  _$jscoverage['collections/MaxHeap.js'][28] = 0;
  _$jscoverage['collections/MaxHeap.js'][29] = 0;
  _$jscoverage['collections/MaxHeap.js'][30] = 0;
  _$jscoverage['collections/MaxHeap.js'][31] = 0;
  _$jscoverage['collections/MaxHeap.js'][33] = 0;
  _$jscoverage['collections/MaxHeap.js'][36] = 0;
  _$jscoverage['collections/MaxHeap.js'][40] = 0;
  _$jscoverage['collections/MaxHeap.js'][41] = 0;
  _$jscoverage['collections/MaxHeap.js'][42] = 0;
  _$jscoverage['collections/MaxHeap.js'][43] = 0;
  _$jscoverage['collections/MaxHeap.js'][45] = 0;
  _$jscoverage['collections/MaxHeap.js'][46] = 0;
  _$jscoverage['collections/MaxHeap.js'][47] = 0;
  _$jscoverage['collections/MaxHeap.js'][49] = 0;
  _$jscoverage['collections/MaxHeap.js'][50] = 0;
  _$jscoverage['collections/MaxHeap.js'][52] = 0;
  _$jscoverage['collections/MaxHeap.js'][53] = 0;
  _$jscoverage['collections/MaxHeap.js'][54] = 0;
  _$jscoverage['collections/MaxHeap.js'][56] = 0;
  _$jscoverage['collections/MaxHeap.js'][60] = 0;
}
_$jscoverage['collections/MaxHeap.js'][1]++;
var define = require("../define").define, Heap = require("./Heap"), base = require("../base");
_$jscoverage['collections/MaxHeap.js'][20]++;
exports = module.exports = define(Heap, {instance: {__upHeap: (function (index) {
  _$jscoverage['collections/MaxHeap.js'][25]++;
  var heap = this.__heap;
  _$jscoverage['collections/MaxHeap.js'][26]++;
  var node = heap[index];
  _$jscoverage['collections/MaxHeap.js'][27]++;
  while (index >= 0) {
    _$jscoverage['collections/MaxHeap.js'][28]++;
    var parentIndex = this.__getParentIndex(index), parent = heap[parentIndex];
    _$jscoverage['collections/MaxHeap.js'][29]++;
    if (parent && parent.key < node.key) {
      _$jscoverage['collections/MaxHeap.js'][30]++;
      heap[index] = parent;
      _$jscoverage['collections/MaxHeap.js'][31]++;
      index = parentIndex;
    }
    else {
      _$jscoverage['collections/MaxHeap.js'][33]++;
      break;
    }
}
  _$jscoverage['collections/MaxHeap.js'][36]++;
  heap[index] = node;
}), __downHeap: (function (index) {
  _$jscoverage['collections/MaxHeap.js'][40]++;
  var heap = this.__heap;
  _$jscoverage['collections/MaxHeap.js'][41]++;
  var node = heap[index], length = heap.length;
  _$jscoverage['collections/MaxHeap.js'][42]++;
  while (index < Math.floor(length / 2)) {
    _$jscoverage['collections/MaxHeap.js'][43]++;
    var leftIndex = this.__getLeftChildIndex(index), rightIndex = this.__getRightChildIndex(index), left = heap[leftIndex], right = heap[rightIndex], child, childIndex;
    _$jscoverage['collections/MaxHeap.js'][45]++;
    if (rightIndex < length && right.key < left.key) {
      _$jscoverage['collections/MaxHeap.js'][46]++;
      childIndex = leftIndex;
      _$jscoverage['collections/MaxHeap.js'][47]++;
      child = left;
    }
    else {
      _$jscoverage['collections/MaxHeap.js'][49]++;
      childIndex = leftIndex;
      _$jscoverage['collections/MaxHeap.js'][50]++;
      child = heap[leftIndex];
    }
    _$jscoverage['collections/MaxHeap.js'][52]++;
    if (child.key > node.key) {
      _$jscoverage['collections/MaxHeap.js'][53]++;
      heap[index] = child;
      _$jscoverage['collections/MaxHeap.js'][54]++;
      index = childIndex;
    }
    else {
      _$jscoverage['collections/MaxHeap.js'][56]++;
      break;
    }
}
  _$jscoverage['collections/MaxHeap.js'][60]++;
  heap[index] = node;
})}});
_$jscoverage['collections/MaxHeap.js'].source = ["var define = require(\"../define\").define,","        Heap = require(\"./Heap\"),","        base = require(\"../base\");","","/**"," * @class &lt;p&gt; Min Heap implementation, lowest value in heap is always at the root.&lt;/p&gt;"," * &lt;/br&gt;"," * &lt;b&gt;Performance&lt;/b&gt;"," * &lt;table&gt;"," *     &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Best&lt;/td&gt;&lt;td&gt;Worst&lt;/td&gt;&lt;/tr&gt;"," *     &lt;tr&gt;&lt;td&gt;Insert&lt;/td&gt;&lt;td&gt;O(log n)&lt;/td&gt;&lt;td&gt;O(log n)&lt;/td&gt;&lt;/tr&gt;"," *     &lt;tr&gt;&lt;td&gt;Remove&lt;/td&gt;&lt;td&gt;O(log n)&lt;/td&gt;&lt;td&gt;O(log n)&lt;/td&gt;&lt;/tr&gt;"," *     &lt;tr&gt;&lt;td&gt;Peek&lt;/td&gt;&lt;td&gt;O(1)&lt;/td&gt;&lt;td&gt;O(1)&lt;/td&gt;&lt;/tr&gt;"," *     &lt;tr&gt;&lt;td&gt;Contains&lt;/td&gt;&lt;td&gt;O(n)&lt;/td&gt;&lt;td&gt;O(n)&lt;/td&gt;&lt;/tr&gt;"," * &lt;table&gt;"," * @name MaxHeap"," * @augments comb.collections.Heap"," * @memberOf comb.collections"," */","exports = module.exports = define(Heap, {","    instance : {","","","        __upHeap : function(index) {","            var heap = this.__heap;","            var node = heap[index];","            while (index &gt;= 0) {","                var parentIndex = this.__getParentIndex(index), parent = heap[parentIndex];","                if (parent &amp;&amp; parent.key &lt; node.key) {","                    heap[index] = parent;","                    index = parentIndex;","                } else {","                    break;","                }","            }","            heap[index] = node;","        },","","        __downHeap : function(index) {","            var heap = this.__heap;","            var node = heap[index], length = heap.length;","            while (index &lt; Math.floor(length / 2)) {","                var leftIndex = this.__getLeftChildIndex(index),","                        rightIndex = this.__getRightChildIndex(index), left = heap[leftIndex], right = heap[rightIndex], child, childIndex;","                if (rightIndex &lt; length &amp;&amp; right.key &lt; left.key) {","                    childIndex = leftIndex;","                    child = left","                } else {","                    childIndex = leftIndex;","                    child = heap[leftIndex];","                }","                if(child.key &gt; node.key){","                    heap[index] = child;","                    index = childIndex;","                }else{","                    break;","                }","","            }","            heap[index] = node;","        }","","    }","});"];
