Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Indices (1 indexed) are now shown on the heap array representation

  • Loading branch information...
commit 440fd67e71d7fc10c5fec863fbe4dc5038550349 1 parent ed75adb
@vkaravir authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 extras/binaryheap.js
View
8 extras/binaryheap.js
@@ -38,7 +38,7 @@
var BinaryHeap = function(jsav, element, options) {
this.jsav = jsav;
- this.options = options;
+ this.options = $.extend({indexed: true}, options);
if ($.isArray(element)) {
var arrsize = element.length;
if ('size' in options) {
@@ -63,6 +63,11 @@
this.initializeFromElement();
}
+ if (this.options.indexed) {
+ $.each(this.element.find(".jsavindexlabel"), function(index, item) {
+ $(item).html(index + 1);
+ });
+ }
var oldfx = $.fx.off || false;
$.fx.off = true;
@@ -70,6 +75,7 @@
this.stats = {"swaps": 0, "leftswaps": 0, "rightswaps": 0,
"recursiveswaps": 0, "partlyrecursiveswaps": 0};
}
+
if (options.tree) {
this._tree = jsav.ds.bintree(options);
inittree(this);
Please sign in to comment.
Something went wrong with that request. Please try again.