code: function bubble_up(i) {
      var p = parent(i);
      while (p >= 0 && tree[i][key] < tree[p][key]) {
  
        /* swap with parent */
        tree[i] = tree.splice(p, 1, tree[i])[0];
  
        /* go up one level */
        i = p;
        p = parent(i);
      }
    }
docs: /* Helper function to swap elements with their parent
  as long as the parent is bigger