let rec bubbleup heap idx =
try
let parent = (parent idx) in
if heap.compare (get heap idx) (get heap parent) < 0
then (swap heap idx parent;
bubbleup heap parent)
else ()
with
| _ -> ()