Comparing version 1.1.1 to 1.2.0
var typedoc = typedoc || {}; | ||
typedoc.search = typedoc.search || {}; | ||
typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","262144":"Accessor","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"Heap\"","url":"modules/_heap_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":128,"name":"Heap","url":"classes/_heap_.heap.html","classes":"tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"Heap\""},{"id":2,"kind":1024,"name":"heapArray","url":"classes/_heap_.heap.html#heaparray","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":3,"kind":1024,"name":"compare","url":"classes/_heap_.heap.html#compare","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":4,"kind":1024,"name":"_limit","url":"classes/_heap_.heap.html#_limit","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":5,"kind":1024,"name":"offer","url":"classes/_heap_.heap.html#offer","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":6,"kind":1024,"name":"element","url":"classes/_heap_.heap.html#element","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":7,"kind":1024,"name":"poll","url":"classes/_heap_.heap.html#poll","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":8,"kind":512,"name":"constructor","url":"classes/_heap_.heap.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":9,"kind":2048,"name":"getChildrenIndexOf","url":"classes/_heap_.heap.html#getchildrenindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":10,"kind":2048,"name":"getParentIndexOf","url":"classes/_heap_.heap.html#getparentindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":11,"kind":2048,"name":"minComparator","url":"classes/_heap_.heap.html#mincomparator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":12,"kind":2048,"name":"maxComparator","url":"classes/_heap_.heap.html#maxcomparator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":13,"kind":2048,"name":"defaultIsEqual","url":"classes/_heap_.heap.html#defaultisequal","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":14,"kind":2048,"name":"print","url":"classes/_heap_.heap.html#print","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":15,"kind":2048,"name":"heapify","url":"classes/_heap_.heap.html#heapify","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":16,"kind":2048,"name":"heappop","url":"classes/_heap_.heap.html#heappop","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":17,"kind":2048,"name":"heappush","url":"classes/_heap_.heap.html#heappush","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":18,"kind":2048,"name":"heappushpop","url":"classes/_heap_.heap.html#heappushpop","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":19,"kind":2048,"name":"heapreplace","url":"classes/_heap_.heap.html#heapreplace","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":20,"kind":2048,"name":"add","url":"classes/_heap_.heap.html#add","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":21,"kind":2048,"name":"addAll","url":"classes/_heap_.heap.html#addall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":22,"kind":2048,"name":"check","url":"classes/_heap_.heap.html#check","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":23,"kind":2048,"name":"clear","url":"classes/_heap_.heap.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":24,"kind":2048,"name":"clone","url":"classes/_heap_.heap.html#clone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":25,"kind":2048,"name":"comparator","url":"classes/_heap_.heap.html#comparator","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":26,"kind":2048,"name":"contains","url":"classes/_heap_.heap.html#contains","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":27,"kind":2048,"name":"init","url":"classes/_heap_.heap.html#init","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":28,"kind":2048,"name":"isEmpty","url":"classes/_heap_.heap.html#isempty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":29,"kind":262144,"name":"length","url":"classes/_heap_.heap.html#length","classes":"tsd-kind-get-signature tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":30,"kind":262144,"name":"limit","url":"classes/_heap_.heap.html#limit","classes":"tsd-kind-accessor tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":31,"kind":2048,"name":"peek","url":"classes/_heap_.heap.html#peek","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":32,"kind":2048,"name":"pop","url":"classes/_heap_.heap.html#pop","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":33,"kind":2048,"name":"push","url":"classes/_heap_.heap.html#push","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":34,"kind":2048,"name":"pushpop","url":"classes/_heap_.heap.html#pushpop","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":35,"kind":2048,"name":"remove","url":"classes/_heap_.heap.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":36,"kind":2048,"name":"replace","url":"classes/_heap_.heap.html#replace","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":37,"kind":2048,"name":"size","url":"classes/_heap_.heap.html#size","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":38,"kind":2048,"name":"top","url":"classes/_heap_.heap.html#top","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":39,"kind":2048,"name":"toArray","url":"classes/_heap_.heap.html#toarray","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":40,"kind":2048,"name":"toString","url":"classes/_heap_.heap.html#tostring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":41,"kind":2048,"name":"get","url":"classes/_heap_.heap.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":42,"kind":2048,"name":"getChildrenOf","url":"classes/_heap_.heap.html#getchildrenof","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":43,"kind":2048,"name":"getParentOf","url":"classes/_heap_.heap.html#getparentof","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":44,"kind":2048,"name":"_applyLimit","url":"classes/_heap_.heap.html#_applylimit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":45,"kind":2048,"name":"_invertedCompare","url":"classes/_heap_.heap.html#_invertedcompare","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":46,"kind":2048,"name":"_moveNode","url":"classes/_heap_.heap.html#_movenode","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":47,"kind":2048,"name":"_sortNodeDown","url":"classes/_heap_.heap.html#_sortnodedown","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":48,"kind":2048,"name":"_sortNodeUp","url":"classes/_heap_.heap.html#_sortnodeup","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":49,"kind":2048,"name":"_topN","url":"classes/_heap_.heap.html#_topn","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":50,"kind":4194304,"name":"Comparator","url":"modules/_heap_.html#comparator","classes":"tsd-kind-type-alias tsd-parent-kind-external-module","parent":"\"Heap\""},{"id":51,"kind":65536,"name":"__type","url":"modules/_heap_.html#comparator.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"Heap\".Comparator"},{"id":52,"kind":4194304,"name":"IsEqual","url":"modules/_heap_.html#isequal","classes":"tsd-kind-type-alias tsd-parent-kind-external-module","parent":"\"Heap\""},{"id":53,"kind":65536,"name":"__type","url":"modules/_heap_.html#isequal.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"Heap\".IsEqual"},{"id":54,"kind":1,"name":"\"Heap.test\"","url":"modules/_heap_test_.html","classes":"tsd-kind-external-module"},{"id":55,"kind":32,"name":"someValues","url":"modules/_heap_test_.html#somevalues","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"Heap.test\""},{"id":56,"kind":32,"name":"otherValues","url":"modules/_heap_test_.html#othervalues","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"Heap.test\""}]}; | ||
typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","262144":"Accessor","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"Heap\"","url":"modules/_heap_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":128,"name":"Heap","url":"classes/_heap_.heap.html","classes":"tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"Heap\""},{"id":2,"kind":1024,"name":"heapArray","url":"classes/_heap_.heap.html#heaparray","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":3,"kind":1024,"name":"compare","url":"classes/_heap_.heap.html#compare","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":4,"kind":1024,"name":"_limit","url":"classes/_heap_.heap.html#_limit","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":5,"kind":1024,"name":"offer","url":"classes/_heap_.heap.html#offer","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":6,"kind":1024,"name":"element","url":"classes/_heap_.heap.html#element","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":7,"kind":1024,"name":"poll","url":"classes/_heap_.heap.html#poll","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":8,"kind":512,"name":"constructor","url":"classes/_heap_.heap.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":9,"kind":2048,"name":"getChildrenIndexOf","url":"classes/_heap_.heap.html#getchildrenindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":10,"kind":2048,"name":"getParentIndexOf","url":"classes/_heap_.heap.html#getparentindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":11,"kind":2048,"name":"getSiblingIndexOf","url":"classes/_heap_.heap.html#getsiblingindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":12,"kind":2048,"name":"minComparator","url":"classes/_heap_.heap.html#mincomparator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":13,"kind":2048,"name":"maxComparator","url":"classes/_heap_.heap.html#maxcomparator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"\"Heap\".Heap"},{"id":14,"kind":2048,"name":"defaultIsEqual","url":"classes/_heap_.heap.html#defaultisequal","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":15,"kind":2048,"name":"print","url":"classes/_heap_.heap.html#print","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":16,"kind":2048,"name":"heapify","url":"classes/_heap_.heap.html#heapify","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":17,"kind":2048,"name":"heappop","url":"classes/_heap_.heap.html#heappop","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":18,"kind":2048,"name":"heappush","url":"classes/_heap_.heap.html#heappush","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":19,"kind":2048,"name":"heappushpop","url":"classes/_heap_.heap.html#heappushpop","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":20,"kind":2048,"name":"heapreplace","url":"classes/_heap_.heap.html#heapreplace","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":21,"kind":2048,"name":"heaptop","url":"classes/_heap_.heap.html#heaptop","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":22,"kind":2048,"name":"heapbottom","url":"classes/_heap_.heap.html#heapbottom","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"\"Heap\".Heap"},{"id":23,"kind":2048,"name":"add","url":"classes/_heap_.heap.html#add","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":24,"kind":2048,"name":"addAll","url":"classes/_heap_.heap.html#addall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":25,"kind":2048,"name":"bottom","url":"classes/_heap_.heap.html#bottom","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":26,"kind":2048,"name":"check","url":"classes/_heap_.heap.html#check","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":27,"kind":2048,"name":"clear","url":"classes/_heap_.heap.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":28,"kind":2048,"name":"clone","url":"classes/_heap_.heap.html#clone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":29,"kind":2048,"name":"comparator","url":"classes/_heap_.heap.html#comparator","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":30,"kind":2048,"name":"contains","url":"classes/_heap_.heap.html#contains","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":31,"kind":2048,"name":"init","url":"classes/_heap_.heap.html#init","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":32,"kind":2048,"name":"isEmpty","url":"classes/_heap_.heap.html#isempty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":33,"kind":2048,"name":"leafs","url":"classes/_heap_.heap.html#leafs","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":34,"kind":262144,"name":"length","url":"classes/_heap_.heap.html#length","classes":"tsd-kind-get-signature tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":35,"kind":262144,"name":"limit","url":"classes/_heap_.heap.html#limit","classes":"tsd-kind-accessor tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":36,"kind":2048,"name":"peek","url":"classes/_heap_.heap.html#peek","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":37,"kind":2048,"name":"pop","url":"classes/_heap_.heap.html#pop","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":38,"kind":2048,"name":"push","url":"classes/_heap_.heap.html#push","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":39,"kind":2048,"name":"pushpop","url":"classes/_heap_.heap.html#pushpop","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":40,"kind":2048,"name":"remove","url":"classes/_heap_.heap.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":41,"kind":2048,"name":"replace","url":"classes/_heap_.heap.html#replace","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":42,"kind":2048,"name":"size","url":"classes/_heap_.heap.html#size","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":43,"kind":2048,"name":"top","url":"classes/_heap_.heap.html#top","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":44,"kind":2048,"name":"toArray","url":"classes/_heap_.heap.html#toarray","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":45,"kind":2048,"name":"toString","url":"classes/_heap_.heap.html#tostring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":46,"kind":2048,"name":"get","url":"classes/_heap_.heap.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":47,"kind":2048,"name":"getChildrenOf","url":"classes/_heap_.heap.html#getchildrenof","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":48,"kind":2048,"name":"getParentOf","url":"classes/_heap_.heap.html#getparentof","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":49,"kind":2048,"name":"_applyLimit","url":"classes/_heap_.heap.html#_applylimit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":50,"kind":2048,"name":"_bottomN","url":"classes/_heap_.heap.html#_bottomn","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":51,"kind":2048,"name":"_invertedCompare","url":"classes/_heap_.heap.html#_invertedcompare","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":52,"kind":2048,"name":"_moveNode","url":"classes/_heap_.heap.html#_movenode","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":53,"kind":2048,"name":"_sortNodeDown","url":"classes/_heap_.heap.html#_sortnodedown","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":54,"kind":2048,"name":"_sortNodeUp","url":"classes/_heap_.heap.html#_sortnodeup","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":55,"kind":2048,"name":"_topN","url":"classes/_heap_.heap.html#_topn","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"Heap\".Heap"},{"id":56,"kind":4194304,"name":"Comparator","url":"modules/_heap_.html#comparator","classes":"tsd-kind-type-alias tsd-parent-kind-external-module","parent":"\"Heap\""},{"id":57,"kind":65536,"name":"__type","url":"modules/_heap_.html#comparator.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"Heap\".Comparator"},{"id":58,"kind":4194304,"name":"IsEqual","url":"modules/_heap_.html#isequal","classes":"tsd-kind-type-alias tsd-parent-kind-external-module","parent":"\"Heap\""},{"id":59,"kind":65536,"name":"__type","url":"modules/_heap_.html#isequal.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"Heap\".IsEqual"},{"id":60,"kind":1,"name":"\"Heap.test\"","url":"modules/_heap_test_.html","classes":"tsd-kind-external-module"},{"id":61,"kind":32,"name":"someValues","url":"modules/_heap_test_.html#somevalues","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"Heap.test\""},{"id":62,"kind":32,"name":"otherValues","url":"modules/_heap_test_.html#othervalues","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"Heap.test\""}]}; |
@@ -50,3 +50,3 @@ /** | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Parent index, undefined if idx is 0 | ||
* @return {Number | undefined} Parent index, -1 if idx is 0 | ||
*/ | ||
@@ -61,2 +61,14 @@ Heap.getParentIndexOf = function (idx) { | ||
/** | ||
* Gets sibling index for given index. | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Sibling index, -1 if idx is 0 | ||
*/ | ||
Heap.getSiblingIndexOf = function (idx) { | ||
if (idx <= 0) { | ||
return -1; | ||
} | ||
var whichChildren = idx % 2 ? 1 : -1; | ||
return idx + whichChildren; | ||
}; | ||
/** | ||
* Min heap comparison function, default. | ||
@@ -147,3 +159,3 @@ * @param {any} a First element | ||
* @param {Function} compare Optional compare function | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
*/ | ||
@@ -158,5 +170,5 @@ Heap.heapify = function (arr, compare) { | ||
* Extract the peek of an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -170,4 +182,4 @@ Heap.heappop = function (heapArr, compare) { | ||
* Pushes a item into an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
@@ -182,6 +194,6 @@ */ | ||
* Push followed by pop, faster | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -195,6 +207,6 @@ Heap.heappushpop = function (heapArr, item, compare) { | ||
* Replace peek with item | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -206,2 +218,28 @@ Heap.heapreplace = function (heapArr, item, compare) { | ||
}; | ||
/** | ||
* Return the `n` most valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
Heap.heaptop = function (heapArr, n, compare) { | ||
if (n === void 0) { n = 1; } | ||
var heap = new Heap(compare); | ||
heap.heapArray = heapArr; | ||
return heap.top(n); | ||
}; | ||
/** | ||
* Return the `n` least valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
Heap.heapbottom = function (heapArr, n, compare) { | ||
if (n === void 0) { n = 1; } | ||
var heap = new Heap(compare); | ||
heap.heapArray = heapArr; | ||
return heap.bottom(n); | ||
}; | ||
/* | ||
@@ -238,2 +276,32 @@ Instance methods | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap. | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype.bottom = function (n) { | ||
if (n === void 0) { n = 1; } | ||
if (this.heapArray.length === 0 || n <= 0) { | ||
// Nothing to do | ||
return []; | ||
} | ||
else if (this.heapArray.length === 1) { | ||
// Just the peek | ||
return [this.heapArray[0]]; | ||
} | ||
else if (n >= this.heapArray.length) { | ||
// The whole peek | ||
// Clone is needed due to the sort method (in-place) that would destroy the heap | ||
var cloned = this.heapArray.slice(0); | ||
cloned.sort(this._invertedCompare); | ||
return cloned; | ||
} | ||
else { | ||
// Some elements | ||
var result = this._bottomN(n); | ||
result.sort(this._invertedCompare); | ||
return result; | ||
} | ||
}; | ||
/** | ||
* Check if the heap is sorted, useful for testing purposes. | ||
@@ -301,2 +369,12 @@ * @return {Undefined | Element} Returns an element if something wrong is found, otherwise it's undefined | ||
}; | ||
/** | ||
* Get the leafs of the tree (no children nodes) | ||
*/ | ||
Heap.prototype.leafs = function () { | ||
if (this.heapArray.length === 0) { | ||
return []; | ||
} | ||
var pi = Heap.getParentIndexOf(this.heapArray.length - 1); | ||
return this.heapArray.slice(pi + 1); | ||
}; | ||
Object.defineProperty(Heap.prototype, "length", { | ||
@@ -377,3 +455,3 @@ /** | ||
Heap.prototype.pushpop = function (element) { | ||
if (this.heapArray[0] < element) { | ||
if (this.compare(this.heapArray[0], element) < 0) { | ||
@@ -438,3 +516,3 @@ _a = [this.heapArray[0], element], element = _a[0], this.heapArray[0] = _a[1]; | ||
/** | ||
* Return the top N elements of the heap. | ||
* Return the top (highest value) N elements of the heap. | ||
* | ||
@@ -446,7 +524,7 @@ * @param {Number} n Number of elements. | ||
if (n === void 0) { n = 1; } | ||
if (n <= 0) { | ||
if (this.heapArray.length === 0 || n <= 0) { | ||
// Nothing to do | ||
return []; | ||
} | ||
else if (n === 1) { | ||
else if (this.heapArray.length === 1 || n === 1) { | ||
// Just the peek | ||
@@ -523,2 +601,31 @@ return [this.heapArray[0]]; | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype._bottomN = function (n) { | ||
// Use an inverted heap | ||
var bottomHeap = new Heap(this.compare); | ||
bottomHeap.limit = n; | ||
bottomHeap.init(this.heapArray.slice(-n)); | ||
var startAt = this.heapArray.length - 1 - n; | ||
var parentStartAt = Heap.getParentIndexOf(startAt); | ||
var indices = []; | ||
for (var i = startAt; i > parentStartAt; --i) { | ||
indices.push(i); | ||
} | ||
var arr = this.heapArray; | ||
while (indices.length) { | ||
var i = indices.shift(); | ||
if (this.compare(arr[i], bottomHeap.peek()) > 0) { | ||
bottomHeap.replace(arr[i]); | ||
if (i % 2) { | ||
indices.push(Heap.getParentIndexOf(i)); | ||
} | ||
} | ||
} | ||
return bottomHeap.toArray(); | ||
}; | ||
/** | ||
* Move a node to a new index, switching places | ||
@@ -588,11 +695,11 @@ * @param {Number} j First node index | ||
/** | ||
* Return the top N elements of the heap, without corner cases, unsorted | ||
* Return the top (highest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype._topN = function (n) { | ||
// Use an inverted heap | ||
var bottomHeap = new Heap(this._invertedCompare); | ||
bottomHeap.limit = n; | ||
var topHeap = new Heap(this._invertedCompare); | ||
topHeap.limit = n; | ||
var indices = [0]; | ||
@@ -603,8 +710,8 @@ var arr = this.heapArray; | ||
if (i < arr.length) { | ||
if (bottomHeap.length < n) { | ||
bottomHeap.push(arr[i]); | ||
if (topHeap.length < n) { | ||
topHeap.push(arr[i]); | ||
indices.push.apply(indices, Heap.getChildrenIndexOf(i)); | ||
} | ||
else if (this.compare(arr[i], bottomHeap.peek()) <= 0) { | ||
bottomHeap.replace(arr[i]); | ||
else if (this.compare(arr[i], topHeap.peek()) <= 0) { | ||
topHeap.replace(arr[i]); | ||
indices.push.apply(indices, Heap.getChildrenIndexOf(i)); | ||
@@ -614,3 +721,3 @@ } | ||
} | ||
return bottomHeap.toArray(); | ||
return topHeap.toArray(); | ||
}; | ||
@@ -617,0 +724,0 @@ return Heap; |
@@ -56,3 +56,3 @@ (function (global, factory) { | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Parent index, undefined if idx is 0 | ||
* @return {Number | undefined} Parent index, -1 if idx is 0 | ||
*/ | ||
@@ -67,2 +67,14 @@ Heap.getParentIndexOf = function (idx) { | ||
/** | ||
* Gets sibling index for given index. | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Sibling index, -1 if idx is 0 | ||
*/ | ||
Heap.getSiblingIndexOf = function (idx) { | ||
if (idx <= 0) { | ||
return -1; | ||
} | ||
var whichChildren = idx % 2 ? 1 : -1; | ||
return idx + whichChildren; | ||
}; | ||
/** | ||
* Min heap comparison function, default. | ||
@@ -153,3 +165,3 @@ * @param {any} a First element | ||
* @param {Function} compare Optional compare function | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
*/ | ||
@@ -164,5 +176,5 @@ Heap.heapify = function (arr, compare) { | ||
* Extract the peek of an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -176,4 +188,4 @@ Heap.heappop = function (heapArr, compare) { | ||
* Pushes a item into an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
@@ -188,6 +200,6 @@ */ | ||
* Push followed by pop, faster | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -201,6 +213,6 @@ Heap.heappushpop = function (heapArr, item, compare) { | ||
* Replace peek with item | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -212,2 +224,28 @@ Heap.heapreplace = function (heapArr, item, compare) { | ||
}; | ||
/** | ||
* Return the `n` most valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
Heap.heaptop = function (heapArr, n, compare) { | ||
if (n === void 0) { n = 1; } | ||
var heap = new Heap(compare); | ||
heap.heapArray = heapArr; | ||
return heap.top(n); | ||
}; | ||
/** | ||
* Return the `n` least valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
Heap.heapbottom = function (heapArr, n, compare) { | ||
if (n === void 0) { n = 1; } | ||
var heap = new Heap(compare); | ||
heap.heapArray = heapArr; | ||
return heap.bottom(n); | ||
}; | ||
/* | ||
@@ -244,2 +282,32 @@ Instance methods | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap. | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype.bottom = function (n) { | ||
if (n === void 0) { n = 1; } | ||
if (this.heapArray.length === 0 || n <= 0) { | ||
// Nothing to do | ||
return []; | ||
} | ||
else if (this.heapArray.length === 1) { | ||
// Just the peek | ||
return [this.heapArray[0]]; | ||
} | ||
else if (n >= this.heapArray.length) { | ||
// The whole peek | ||
// Clone is needed due to the sort method (in-place) that would destroy the heap | ||
var cloned = this.heapArray.slice(0); | ||
cloned.sort(this._invertedCompare); | ||
return cloned; | ||
} | ||
else { | ||
// Some elements | ||
var result = this._bottomN(n); | ||
result.sort(this._invertedCompare); | ||
return result; | ||
} | ||
}; | ||
/** | ||
* Check if the heap is sorted, useful for testing purposes. | ||
@@ -307,2 +375,12 @@ * @return {Undefined | Element} Returns an element if something wrong is found, otherwise it's undefined | ||
}; | ||
/** | ||
* Get the leafs of the tree (no children nodes) | ||
*/ | ||
Heap.prototype.leafs = function () { | ||
if (this.heapArray.length === 0) { | ||
return []; | ||
} | ||
var pi = Heap.getParentIndexOf(this.heapArray.length - 1); | ||
return this.heapArray.slice(pi + 1); | ||
}; | ||
Object.defineProperty(Heap.prototype, "length", { | ||
@@ -383,3 +461,3 @@ /** | ||
Heap.prototype.pushpop = function (element) { | ||
if (this.heapArray[0] < element) { | ||
if (this.compare(this.heapArray[0], element) < 0) { | ||
@@ -444,3 +522,3 @@ _a = [this.heapArray[0], element], element = _a[0], this.heapArray[0] = _a[1]; | ||
/** | ||
* Return the top N elements of the heap. | ||
* Return the top (highest value) N elements of the heap. | ||
* | ||
@@ -452,7 +530,7 @@ * @param {Number} n Number of elements. | ||
if (n === void 0) { n = 1; } | ||
if (n <= 0) { | ||
if (this.heapArray.length === 0 || n <= 0) { | ||
// Nothing to do | ||
return []; | ||
} | ||
else if (n === 1) { | ||
else if (this.heapArray.length === 1 || n === 1) { | ||
// Just the peek | ||
@@ -529,2 +607,31 @@ return [this.heapArray[0]]; | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype._bottomN = function (n) { | ||
// Use an inverted heap | ||
var bottomHeap = new Heap(this.compare); | ||
bottomHeap.limit = n; | ||
bottomHeap.init(this.heapArray.slice(-n)); | ||
var startAt = this.heapArray.length - 1 - n; | ||
var parentStartAt = Heap.getParentIndexOf(startAt); | ||
var indices = []; | ||
for (var i = startAt; i > parentStartAt; --i) { | ||
indices.push(i); | ||
} | ||
var arr = this.heapArray; | ||
while (indices.length) { | ||
var i = indices.shift(); | ||
if (this.compare(arr[i], bottomHeap.peek()) > 0) { | ||
bottomHeap.replace(arr[i]); | ||
if (i % 2) { | ||
indices.push(Heap.getParentIndexOf(i)); | ||
} | ||
} | ||
} | ||
return bottomHeap.toArray(); | ||
}; | ||
/** | ||
* Move a node to a new index, switching places | ||
@@ -594,11 +701,11 @@ * @param {Number} j First node index | ||
/** | ||
* Return the top N elements of the heap, without corner cases, unsorted | ||
* Return the top (highest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
Heap.prototype._topN = function (n) { | ||
// Use an inverted heap | ||
var bottomHeap = new Heap(this._invertedCompare); | ||
bottomHeap.limit = n; | ||
var topHeap = new Heap(this._invertedCompare); | ||
topHeap.limit = n; | ||
var indices = [0]; | ||
@@ -609,8 +716,8 @@ var arr = this.heapArray; | ||
if (i < arr.length) { | ||
if (bottomHeap.length < n) { | ||
bottomHeap.push(arr[i]); | ||
if (topHeap.length < n) { | ||
topHeap.push(arr[i]); | ||
indices.push.apply(indices, Heap.getChildrenIndexOf(i)); | ||
} | ||
else if (this.compare(arr[i], bottomHeap.peek()) <= 0) { | ||
bottomHeap.replace(arr[i]); | ||
else if (this.compare(arr[i], topHeap.peek()) <= 0) { | ||
topHeap.replace(arr[i]); | ||
indices.push.apply(indices, Heap.getChildrenIndexOf(i)); | ||
@@ -620,3 +727,3 @@ } | ||
} | ||
return bottomHeap.toArray(); | ||
return topHeap.toArray(); | ||
}; | ||
@@ -623,0 +730,0 @@ return Heap; |
@@ -37,6 +37,12 @@ export declare type Comparator<T> = (a: T, b: T) => number; | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Parent index, undefined if idx is 0 | ||
* @return {Number | undefined} Parent index, -1 if idx is 0 | ||
*/ | ||
static getParentIndexOf(idx: number): number; | ||
/** | ||
* Gets sibling index for given index. | ||
* @param {Number} idx Children index | ||
* @return {Number | undefined} Sibling index, -1 if idx is 0 | ||
*/ | ||
static getSiblingIndexOf(idx: number): number; | ||
/** | ||
* Min heap comparison function, default. | ||
@@ -72,3 +78,3 @@ * @param {any} a First element | ||
* @param {Function} compare Optional compare function | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
* @return {Heap} For convenience, it returns a Heap instance | ||
*/ | ||
@@ -78,5 +84,5 @@ static heapify<N>(arr: Array<N>, compare?: Comparator<N>): Heap<N>; | ||
* Extract the peek of an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -86,4 +92,4 @@ static heappop<N>(heapArr: Array<N>, compare?: Comparator<N>): N | undefined; | ||
* Pushes a item into an array-heap | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
@@ -94,6 +100,6 @@ */ | ||
* Push followed by pop, faster | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item to push | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
@@ -103,9 +109,25 @@ static heappushpop<N>(heapArr: Array<N>, item: N, compare?: Comparator<N>): N; | ||
* Replace peek with item | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Array} heapArr Array to be modified, should be a heap | ||
* @param {any} item Item as replacement | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Returns the extracted peek | ||
* @return {any} Returns the extracted peek | ||
*/ | ||
static heapreplace<N>(heapArr: Array<N>, item: N, compare?: Comparator<N>): N; | ||
/** | ||
* Return the `n` most valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
static heaptop<N>(heapArr: Array<N>, n?: number, compare?: Comparator<N>): N[]; | ||
/** | ||
* Return the `n` least valuable elements | ||
* @param {Array} heapArr Array, should be a heap | ||
* @param {number} n Max number of elements | ||
* @param {Function} compare Optional compare function | ||
* @return {any} Elements | ||
*/ | ||
static heapbottom<N>(heapArr: Array<N>, n?: number, compare?: Comparator<N>): N[]; | ||
/** | ||
* Adds an element to the heap. Aliases: `offer`. | ||
@@ -125,2 +147,9 @@ * Same as: push(element) | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap. | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
bottom(n?: number): Array<T>; | ||
/** | ||
* Check if the heap is sorted, useful for testing purposes. | ||
@@ -162,2 +191,6 @@ * @return {Undefined | Element} Returns an element if something wrong is found, otherwise it's undefined | ||
/** | ||
* Get the leafs of the tree (no children nodes) | ||
*/ | ||
leafs(): T[]; | ||
/** | ||
* Length of the heap. | ||
@@ -218,3 +251,3 @@ * @return {Number} | ||
/** | ||
* Return the top N elements of the heap. | ||
* Return the top (highest value) N elements of the heap. | ||
* | ||
@@ -258,2 +291,9 @@ * @param {Number} n Number of elements. | ||
/** | ||
* Return the bottom (lowest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
_bottomN(n: number): Array<T>; | ||
/** | ||
* Returns the inverse to the comparison function. | ||
@@ -280,6 +320,6 @@ * @return {Function} | ||
/** | ||
* Return the top N elements of the heap, without corner cases, unsorted | ||
* Return the top (highest value) N elements of the heap, without corner cases, unsorted | ||
* | ||
* @param {Number} n Number of elements. | ||
* @return {Array} Array of length <= N. | ||
* @return {Array} Array of length <= N. | ||
*/ | ||
@@ -286,0 +326,0 @@ _topN(n: number): Array<T>; |
{ | ||
"name": "heap-js", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Heap data structure for JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "dist/heap-js.umd.js", |
@@ -81,9 +81,12 @@ ![Heap.js](assets/heap-js.png) Heap.js | ||
* `length` of the heap | ||
* `limit` number of elements in the heap | ||
* `pop()` top element | ||
* `push(...elements)` to the heap | ||
* `limit` amount of elements in the heap | ||
* `pop()` the top element | ||
* `push(...elements)` one or more elements to the heap | ||
* `pushpop(element)` faster than `push` & `pop` | ||
* `replace(element)` faster than `pop` & `push` | ||
* `top(number?)` elements from the heap | ||
* `top(number?)` most valuable elements from the heap | ||
* `bottom(number?)` least valuable elements from the heap | ||
Implements Java's `PriorityQueue` interface: | ||
@@ -109,19 +112,23 @@ -------------------------------------------- | ||
To do: | ||
* containsAll | ||
* equals | ||
* iterator() | ||
* retainAll | ||
* `containsAll` | ||
* `equals` | ||
* `iterator()` | ||
* `retainAll` | ||
Implements static Python's `heapq` interface: | ||
--------------------------------------------- | ||
* `Heap.heapify(array)` that converts an array to an array-heap | ||
* `Heap.heappop(heapArray)` that takes the peek of the array-heap | ||
* `Heap.heappush(heapArray, item)` that appends elements to the array-heap | ||
* `Heap.heappushpop(heapArray, item)` faster than `heappush` & `heappop` | ||
* `Heap.heapreplace(heapArray, item)` faster than `heappop` & `heappush` | ||
* `Heap.heapify(array, comparator?)` that converts an array to an array-heap | ||
* `Heap.heappop(heapArray, comparator?)` that takes the peek of the array-heap | ||
* `Heap.heappush(heapArray, item, comparator?)` that appends elements to the array-heap | ||
* `Heap.heappushpop(heapArray, item, comparator?)` faster than `heappush` & `heappop` | ||
* `Heap.heapreplace(heapArray, item, comparator?)` faster than `heappop` & `heappush` | ||
Extras: | ||
* `Heap.heaptop(n, heapArray, comparator?)` that returns the `n` most valuable elements of the array-heap | ||
* `Heap.heapbottom(n, heapArray, comparator?)` that returns the `n` least valuable elements of the array-heap | ||
To do: | ||
* merge(*iterables, key=None, reverse=False) | ||
* nlargest(n, iterable, key=None) | ||
* nsmallest(n, iterable, key=None) | ||
* `merge(...iterables, comparator?)` | ||
* `nlargest(n, iterable, comparator?)` | ||
* `nsmallest(n, iterable, comparator?)` | ||
@@ -128,0 +135,0 @@ Documentation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1968938
2959
160