Implement heap clone with passing an array of the original's data

This commit is contained in:
Slava Kim
2014-02-20 21:45:28 -08:00
parent 006e307f15
commit 19eeff650a

View File

@@ -180,9 +180,7 @@ _.extend(MaxHeap.prototype, {
},
clone: function () {
var self = this;
var clone = new MaxHeap(self._comparator);
clone._heap = EJSON.clone(self._heap);
clone._heapIdx = self._heapIdx.clone();
var clone = new MaxHeap(self._comparator, self._heap);
return clone;
},