public static void Main(string[] args)
        {
            BinaryHeap <int> test = new BinaryHeap <int>();

            test.Add(4);
            test.Add(6);
            test.Add(9);
            test.Add(23);


            Console.WriteLine(test.Count);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            BinaryHeap <int> priorityQueue = new BinaryHeap <int>();

            priorityQueue.Add(4);
            priorityQueue.Add(6);
            priorityQueue.Add(9);
            priorityQueue.Add(22);
            priorityQueue.Add(5);
            priorityQueue.Add(3);
            priorityQueue.Add(13);
            priorityQueue.Add(37);
            priorityQueue.Add(100);
            priorityQueue.Add(46);

            while (priorityQueue.Count > 0)
            {
                Console.WriteLine(priorityQueue.Remove());
            }
        }
Ejemplo n.º 3
0
        private static void TestHeap2()
        {
            var comper = new Comper();
            var heap   = new BinaryHeap <int>(comper);

            heap.Add(4);
            heap.Add(7);
            heap.Add(1);
            heap.Add(777);
            heap.Add(12);
            heap.Add(3);
            Console.WriteLine(heap.GetTopElement());
        }
Ejemplo n.º 4
0
        private static void TestHeapInt()
        {
            var heap = new BinaryHeap <int>();

            heap.Add(4);
            heap.Add(7);
            heap.Add(1);
            heap.Add(777);
            heap.Add(12);
            heap.Add(3);
            heap.RemoveTop();
            Console.WriteLine(heap.GetTopElement());
        }