Exemple #1
0
        public HeapNode ExtractTop()
        {
            HeapNode top = null;

            if (Size > 0)
            {
                top = elements[0];

                Swap(elements, 0, elements.Count - 1);

                elements.RemoveAt(elements.Count - 1);

                MinHeapify(0);
            }

            return(top);
        }
Exemple #2
0
 public void ReplaceMin(int num, int listIndex)
 {
     elements[0] = new HeapNode(num, listIndex);
     MinHeapify(0);
 }