Exemplo n.º 1
0
 public Iterator(QueueImplementedByLinkedList <T> outerClassObj)
 {
     _outerClassInstance = outerClassObj;
     _currentNode        = new Node
     {
         data = default(T),
         next = _outerClassInstance.first
     };
 }
Exemplo n.º 2
0
        public static void RunClient(string sample)
        {
            QueueImplementedByLinkedList <string> s = new QueueImplementedByLinkedList <string>();
            var items = sample.Split(' ').ToList();

            foreach (var item in items)
            {
                if (item != "-")
                {
                    s.Enqueue(item);
                }
                else if (!s.IsEmpty())
                {
                    Console.Write(s.Dequeue() + " ");
                }
            }

            Console.WriteLine("(" + s.Size() + " left on queue )");
        }