lib/compsci/heap.rb in compsci-0.2.0.1 vs lib/compsci/heap.rb in compsci-0.3.0.1
- old
+ new
@@ -63,9 +63,10 @@
# * idx represents the node suspected to violate the heap
# * intended to be O(log n) on heap size (log base child_slots)
#
def sift_up(idx)
return self if idx <= 0
+ # print '.'
pidx = self.class.parent_idx(idx, @child_slots)
if !self.heapish?(pidx, idx)
@array[idx], @array[pidx] = @array[pidx], @array[idx] # swap
self.sift_up(pidx)
end