Exemplo n.º 1
0
        public void Min_priority_queue()
        {
            var p = new MinPQ<int>(5);
            p.Insert(5);
            Assert.AreEqual("5", string.Join(",", p.CurrentPQ()));

            p.Insert(4);
            Assert.AreEqual("4,5", string.Join(",", p.CurrentPQ()));

            p.Insert(99);
            Assert.AreEqual("4,5,99", string.Join(",", p.CurrentPQ()));

            p.Insert(14);
            Assert.AreEqual("4,5,99,14", string.Join(",", p.CurrentPQ()));

            p.Insert(0);
            Assert.AreEqual("0,4,99,14,5", string.Join(",", p.CurrentPQ()));
        }