예제 #1
0
        public void TestEnqueue()
        {
            SQueue queue    = new SQueue(new Node(0));
            Node   testNode = new Node(100);

            queue.Enqueue(testNode);
            Assert.Equal(testNode, queue.Peek().Next);
        }
예제 #2
0
        public void TestDequeue()
        {
            Node   testNode1 = new Node(100);
            Node   testNode2 = new Node(999);
            SQueue queue     = new SQueue(testNode1);

            queue.Enqueue(testNode2);
            Assert.True(queue.Dequeue() == testNode1 && queue.Peek() == testNode2);
        }
예제 #3
0
파일: Program.cs 프로젝트: BenSTay/DSA-old
        /// <summary>
        /// Displays the SQueue in the console.
        /// </summary>
        /// <param name="queue">The SQueue being displayed.</param>
        static void ViewQueue(SQueue queue)
        {
            Node node = queue.Peek();

            Console.Write("FRONT --> ");
            while (node != null)
            {
                Console.Write($"{node.Value} --> ");
                node = node.Next;
            }
            Console.Write("NULL\n");
        }