Commit Graph

29 Commits

Author SHA1 Message Date
Slava Kim
7bd160192c Replace ad-hoc inheritance with Meteor._inherit calls 2014-02-24 23:58:31 -08:00
Slava Kim
6dfd5bfc29 Additional generated tests for min-max-heap 2014-02-24 21:25:17 -08:00
Slava Kim
9451416f27 Use options object in MaxHeap constructor and allow passing a custom IdMap class 2014-02-24 20:29:39 -08:00
Slava Kim
97f7ccfa63 Glasser's comments 2014-02-24 20:22:24 -08:00
Slava Kim
a6410c4af7 A comment on Min-Max-Heap implementation 2014-02-21 18:23:58 -08:00
Slava Kim
f38294b173 Binary-Heap: update in-place 2014-02-21 18:19:13 -08:00
Slava Kim
1dc172696f minor stylish tweak 2014-02-21 18:12:35 -08:00
Slava Kim
133428e6e5 Fix the removal and the priority of _maxIndex.
Removing an arbitary element you might need to upHeap the position of removed
element instead of downHeap. It is not the case with the maximum, because root
can't be upHeaped.
2014-02-21 17:48:37 -08:00
Slava Kim
b01ed021ea New giant randomized test with self-checks 2014-02-21 17:48:22 -08:00
Slava Kim
74553efa30 Binary-heap: avoid capitalized names for non-classes 2014-02-21 14:35:55 -08:00
Slava Kim
e853ced77c Binary-heap: refactor out the _maxIndex method 2014-02-21 14:35:01 -08:00
Slava Kim
503c5f263f Extra safety belt for binary-heap constructor 2014-02-21 14:27:32 -08:00
Slava Kim
7bad26e796 Make min-max-heap's clone work in the same way it works for max-heap 2014-02-21 14:25:06 -08:00
Slava Kim
d87b18a56e Fix building heap from array 2014-02-20 22:38:56 -08:00
Slava Kim
19eeff650a Implement heap clone with passing an array of the original's data 2014-02-20 21:45:28 -08:00
Slava Kim
006e307f15 More comments on Heap implementation, linear initialization doesn't retain anything but the references to the values. 2014-02-20 21:38:09 -08:00
Slava Kim
cd918bbf17 binary-heap uses id-map 2014-02-20 17:13:52 -08:00
Slava Kim
939d8d7e7f es3 friendly inheritance 2014-02-20 16:29:01 -08:00
Slava Kim
3fa5fd9342 binary-heap: Fix rightChildIdx() 2014-02-20 14:05:12 -08:00
Slava Kim
b4e94c3b2a A randomized test for max-heap 2014-02-20 14:04:27 -08:00
Slava Kim
b76fd3c3af Rename BinaryHeap to MaxHeap and MaxMinHeap to MinMaxHeap 2014-02-20 13:47:22 -08:00
Slava Kim
4631f24377 Fix _upHeap and fix oop once again 2014-02-18 15:27:48 -08:00
Slava Kim
d59200f951 Do OOP right 2014-02-18 15:27:48 -08:00
Slava Kim
4dfb2fee4d A step to MaxMinHeap 2014-02-18 15:27:48 -08:00
Slava Kim
3c4af7cd8f Rename heapify to downHeap to keep it consistent with upHeap
Most text-books use "heapify" but in one text-book I remember the use of
"downHeap", so I didn't make it up.
2014-02-18 15:27:48 -08:00
Slava Kim
70a4d6cba1 Tests for BinaryHeap 2014-02-18 15:27:48 -08:00
Slava Kim
678d607332 Fix remove and get of non-existent id 2014-02-18 15:27:48 -08:00
Slava Kim
7f2c6bb09b The implementation of Heap 2014-02-18 15:27:48 -08:00
Slava Kim
8cad412ea1 init commit for BinaryHeap package
Nothing here yet
2014-02-18 15:27:48 -08:00