/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['collections/MinHeap.js']) {
  _$jscoverage['collections/MinHeap.js'] = [];
  _$jscoverage['collections/MinHeap.js'][1] = 0;
  _$jscoverage['collections/MinHeap.js'][5] = 0;
  _$jscoverage['collections/MinHeap.js'][21] = 0;
  _$jscoverage['collections/MinHeap.js'][25] = 0;
  _$jscoverage['collections/MinHeap.js'][26] = 0;
  _$jscoverage['collections/MinHeap.js'][27] = 0;
  _$jscoverage['collections/MinHeap.js'][28] = 0;
  _$jscoverage['collections/MinHeap.js'][29] = 0;
  _$jscoverage['collections/MinHeap.js'][30] = 0;
  _$jscoverage['collections/MinHeap.js'][31] = 0;
  _$jscoverage['collections/MinHeap.js'][33] = 0;
  _$jscoverage['collections/MinHeap.js'][36] = 0;
  _$jscoverage['collections/MinHeap.js'][40] = 0;
  _$jscoverage['collections/MinHeap.js'][41] = 0;
  _$jscoverage['collections/MinHeap.js'][42] = 0;
  _$jscoverage['collections/MinHeap.js'][43] = 0;
  _$jscoverage['collections/MinHeap.js'][45] = 0;
  _$jscoverage['collections/MinHeap.js'][46] = 0;
  _$jscoverage['collections/MinHeap.js'][47] = 0;
  _$jscoverage['collections/MinHeap.js'][49] = 0;
  _$jscoverage['collections/MinHeap.js'][50] = 0;
  _$jscoverage['collections/MinHeap.js'][52] = 0;
  _$jscoverage['collections/MinHeap.js'][53] = 0;
  _$jscoverage['collections/MinHeap.js'][54] = 0;
  _$jscoverage['collections/MinHeap.js'][56] = 0;
  _$jscoverage['collections/MinHeap.js'][60] = 0;
}
_$jscoverage['collections/MinHeap.js'][1]++;
var define = require("../define").define, Heap = require("./Heap"), base = require("../base");
_$jscoverage['collections/MinHeap.js'][5]++;
var floor = Math.floor, MinHeap;
_$jscoverage['collections/MinHeap.js'][21]++;
module.exports = exports = define(Heap, {instance: {__upHeap: (function (index) {
  _$jscoverage['collections/MinHeap.js'][25]++;
  var heap = this.__heap;
  _$jscoverage['collections/MinHeap.js'][26]++;
  var node = heap[index], key = node.key, gpi = this.__getParentIndex;
  _$jscoverage['collections/MinHeap.js'][27]++;
  while (index >= 0) {
    _$jscoverage['collections/MinHeap.js'][28]++;
    var parentIndex = gpi(index), parent = heap[parentIndex];
    _$jscoverage['collections/MinHeap.js'][29]++;
    if (parent && parent.key > key) {
      _$jscoverage['collections/MinHeap.js'][30]++;
      heap[index] = parent;
      _$jscoverage['collections/MinHeap.js'][31]++;
      index = parentIndex;
    }
    else {
      _$jscoverage['collections/MinHeap.js'][33]++;
      break;
    }
}
  _$jscoverage['collections/MinHeap.js'][36]++;
  heap[index] = node;
}), __downHeap: (function (index) {
  _$jscoverage['collections/MinHeap.js'][40]++;
  var heap = this.__heap;
  _$jscoverage['collections/MinHeap.js'][41]++;
  var node = heap[index], key = node.key, length = heap.length, max = floor(length / 2), glci = this.__getLeftChildIndex, grci = this.__getRightChildIndex;
  _$jscoverage['collections/MinHeap.js'][42]++;
  while (index < max) {
    _$jscoverage['collections/MinHeap.js'][43]++;
    var leftIndex = glci(index), rightIndex = grci(index), left = heap[leftIndex], right = heap[rightIndex], child, childIndex;
    _$jscoverage['collections/MinHeap.js'][45]++;
    if (rightIndex < length && right.key < left.key) {
      _$jscoverage['collections/MinHeap.js'][46]++;
      childIndex = rightIndex;
      _$jscoverage['collections/MinHeap.js'][47]++;
      child = right;
    }
    else {
      _$jscoverage['collections/MinHeap.js'][49]++;
      childIndex = leftIndex;
      _$jscoverage['collections/MinHeap.js'][50]++;
      child = left;
    }
    _$jscoverage['collections/MinHeap.js'][52]++;
    if (child.key < key) {
      _$jscoverage['collections/MinHeap.js'][53]++;
      heap[index] = child;
      _$jscoverage['collections/MinHeap.js'][54]++;
      index = childIndex;
    }
    else {
      _$jscoverage['collections/MinHeap.js'][56]++;
      break;
    }
}
  _$jscoverage['collections/MinHeap.js'][60]++;
  heap[index] = node;
})}});
_$jscoverage['collections/MinHeap.js'].source = ["var define = require(\"../define\").define,","        Heap = require(\"./Heap\"),","        base = require(\"../base\");","","var floor = Math.floor, MinHeap;","/**"," * @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 MinHeap"," * @augments comb.collections.Heap"," * @memberOf comb.collections"," */","module.exports = exports = define(Heap, {","    instance : {","","        __upHeap : function(index) {","            var heap = this.__heap;","            var node = heap[index], key = node.key, gpi = this.__getParentIndex;","            while (index &gt;= 0) {","                var parentIndex = gpi(index), parent = heap[parentIndex];","                if (parent &amp;&amp; parent.key &gt; key) {","                    heap[index] = parent;","                    index = parentIndex;","                } else {","                    break;","                }","            }","            heap[index] = node;","        },","","        __downHeap : function(index) {","            var heap = this.__heap;","            var node = heap[index], key = node.key, length = heap.length, max = floor(length / 2), glci = this.__getLeftChildIndex, grci = this.__getRightChildIndex;","            while (index &lt; max) {","                var leftIndex = glci(index),","                        rightIndex = grci(index), left = heap[leftIndex], right = heap[rightIndex], child, childIndex;","                if (rightIndex &lt; length &amp;&amp; right.key &lt; left.key) {","                    childIndex = rightIndex;","                    child = right;","                } else {","                    childIndex = leftIndex;","                    child = left;","                }","                if (child.key &lt; key) {","                    heap[index] = child;","                    index = childIndex;","                } else {","                    break;","                }","","            }","            heap[index] = node;","        }","    }","});",""];
