static void Main(string[] args)
        {
            var queue = new MyQueueWithArray <int>();

            queue.EnQueue(8);
            queue.DeQueue();
            queue.DeQueue();
            queue.EnQueue(10);
            myQueue.Print(front, rear);
        }
Esempio n. 2
0
        public void LevelOrderTraversal(Node node)
        {
            var queue = new MyQueueWithArray <Node>();

            queue.EnQueue(node);
            while (!queue.IsEmpty())
            {
                var item = queue.DeQueue();
                if (item != null)
                {
                    Console.Write($"{item.Data} ");
                    queue.EnQueue(item.Left);
                    queue.EnQueue(item.Right);
                }
            }
        }