示例#1
0
        public static void Main()
        {
            var pr = new PriorityQueue();

            Console.WriteLine(pr.Extract().Value);

            pr.Insert(new Elem()
            {
                Priority = 10, Value = "A"
            });
            pr.Insert(new Elem()
            {
                Priority = 6, Value = "B"
            });
            pr.Insert(new Elem()
            {
                Priority = 17, Value = "C"
            });
            pr.Insert(new Elem()
            {
                Priority = 150, Value = "D"
            });
            pr.Insert(new Elem()
            {
                Priority = 62, Value = "E"
            });
            pr.Insert(new Elem()
            {
                Priority = 3, Value = "F"
            });
            pr.Insert(new Elem()
            {
                Priority = 15, Value = "G"
            });
            pr.Insert(new Elem()
            {
                Priority = 36, Value = "H"
            });
            pr.Insert(new Elem()
            {
                Priority = 1, Value = "I"
            });

            Console.WriteLine(pr);

            Console.WriteLine(pr.Extract().Value);
            Console.WriteLine(pr);

            Console.WriteLine(pr.Extract().Value);
            Console.WriteLine(pr);
            pr.Insert(new Elem()
            {
                Priority = 16, Value = "K"
            });
            Console.WriteLine(pr);

            Console.WriteLine(pr.Extract().Value);
            Console.WriteLine(pr);
        }