public static void Main(string[] args) { var heap = new MinHeap <int>(); for (int i = 0; i < 15; i++) { if (i % 2 == 0) { i *= -1; } heap.Insert(i); } Console.WriteLine(heap.Count); Console.WriteLine(heap.ExtractMin()); Console.WriteLine(); }
static void Main(string[] args) { var numbers = new int[] { 1, 5, 2, 14, 5, 1, 0 }; var heap = new MinHeap <int>(); foreach (var item in numbers) { heap.Insert(item); } while (heap.Count > 0) { Console.WriteLine(heap.ExtractMin()); } }