Example #1
0
        public void Swap(int a, int b)
        {
            HeapTreeNode <T> tmp = Tree[a];

            Tree[a] = Tree[b];
            Tree[b] = tmp;
        }
Example #2
0
 public void Insert(HeapTreeNode <T> node)
 {
     Tree.Add(node);
     for (int i = Tree.Count(); i > 0; i = (i - 1) / 2)
     {
         bool have2Change = isMaxHeap ?
                            Tree[(i - 1) / 2].key > Tree[i].key :
                            Tree[(i - 1) / 2].key < Tree[i].key;
     }
 }