Exemplo n.º 1
0
        public static void Main()
        {
            var arr = new int[] { 1, 23, 3, 500, 0, 500, 47, -132, 0, 3, 6, 5, 33, 89 };

            Heap <int> .Sort(arr);

            Console.WriteLine(string.Join(", ", arr));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int[]      array   = new int[] { 5, 90, 0, 20, 57, 1, 90, 300 };
            Heap <int> MaxHeap = new Heap <int>(array);

            MaxHeap.InsertKey(300);
            MaxHeap.Sort();
            string str = MaxHeap.Display();

            Console.WriteLine(str);
            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var array = new[] { 1, 124, 23, 245, 2, 4, 6, 5670, 7, 3 };

            Heap.Sort(array);

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }

            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var a = new List <int> {
                19, 8, 3, 50, 12, 59, 20, 32, 34, 75, 2
            };
            var heap = new Heap(a);

            heap.Sort();
            foreach (var x in heap.Data)
            {
                Console.Write(x + " ");
            }
            Console.Read();
        }