示例#1
0
        public void PriorityQueuePush1()
        {
            var queue = new BinaryHeapMax(7); // PriorityQueue

            queue.Push(1);
            queue.Push(2);
            queue.Push(3);
            queue.Push(4);
            queue.Push(5);
            queue.Push(6);
            queue.Push(7);

            var arr = queue.Array;
        }
示例#2
0
        public void PriorityQueuePop2()
        {
            var queue = new BinaryHeapMax(7);  // PriorityQueue

            queue.Push(7);
            queue.Push(6);
            queue.Push(5);
            queue.Push(4);
            queue.Push(3);
            queue.Push(2);
            queue.Push(1);

            // pop
            while (!queue.IsEmpty)
            {
                int top = queue.Pop();
                var arr = queue.Array;
                Console.WriteLine(top);
            }
        }