Skip to content

Commit

Permalink
fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
clarketm committed Apr 28, 2019
1 parent 5ea3dcc commit 0ce7f83
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 23 deletions.
11 changes: 8 additions & 3 deletions dist/super.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1846,9 +1846,14 @@ var Heap = function () {
key: "deleteMax",
value: function deleteMax() {
var _return = this._heap[0];
var _min = this._heap.pop();
if (this._heap.length > 1) this._heap[0] = _min;
this._percolateDown(0);

if (this._heap.length === 1) {
this._heap.pop();
} else {
this._heap[0] = this._heap.pop();
this._percolateDown(0);
}

return _return;
}

Expand Down
11 changes: 8 additions & 3 deletions dist/super.js
Original file line number Diff line number Diff line change
Expand Up @@ -1852,9 +1852,14 @@
key: "deleteMax",
value: function deleteMax() {
var _return = this._heap[0];
var _min = this._heap.pop();
if (this._heap.length > 1) this._heap[0] = _min;
this._percolateDown(0);

if (this._heap.length === 1) {
this._heap.pop();
} else {
this._heap[0] = this._heap.pop();
this._percolateDown(0);
}

return _return;
}

Expand Down
19 changes: 10 additions & 9 deletions dist/super.min.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions packages/Heap/lib/Heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@
key: "deleteMax",
value: function deleteMax() {
var _return = this._heap[0];
var _min = this._heap.pop();
if (this._heap.length > 1) this._heap[0] = _min;
this._percolateDown(0);

if (this._heap.length === 1) {
this._heap.pop();
} else {
this._heap[0] = this._heap.pop();
this._percolateDown(0);
}

return _return;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/Heap/lib/Heap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions packages/Heap/src/lib/Heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,14 @@ class Heap {
*/
deleteMax() {
let _return = this._heap[0];
let _min = this._heap.pop();
if (this._heap.length > 1) this._heap[0] = _min;
this._percolateDown(0);

if (this._heap.length === 1) {
this._heap.pop();
} else {
this._heap[0] = this._heap.pop();
this._percolateDown(0);
}

return _return;
}

Expand Down

0 comments on commit 0ce7f83

Please sign in to comment.