Esempio n. 1
0
        static void Main(string[] args)
        {
            var queue = new FrontMiddleBackQueue();

            queue.PushFront(1);
            queue.PushBack(2);
            queue.PushMiddle(3);
            queue.PushMiddle(4);
            Console.WriteLine(queue.PopFront());
            Console.WriteLine(queue.PopMiddle());
            Console.WriteLine(queue.PopMiddle());
            Console.WriteLine(queue.PopBack());
            Console.WriteLine(queue.PopFront());
        }
Esempio n. 2
0
        private int?ExecuteOperation(string operation, FrontMiddleBackQueue queue, int?arg)
        {
            int?res = null;

            switch (operation)
            {
            case "FrontMiddleBackQueue":
                break;

            case "pushFront":
                queue.PushFront((int)arg);
                break;

            case "pushBack":
                queue.PushBack((int)arg);
                break;

            case "pushMiddle":
                queue.PushMiddle((int)arg);
                break;

            case "popFront":
                res = queue.PopFront();
                break;

            case "popMiddle":
                res = queue.PopMiddle();
                break;

            case "popBack":
                res = queue.PopBack();
                break;
            }

            return(res);
        }