static void Main(string[] args) { Console.WriteLine("Hello World!"); LinkedListStack linkedListStack = new LinkedListStack(); linkedListStack.Push(70); linkedListStack.Push(30); linkedListStack.Push(56); linkedListStack.Display(); linkedListStack.Peek(); linkedListStack.Pop(); linkedListStack.IsEmpty(); linkedListStack.Display(); LinkedListQueue linkedListQueue = new LinkedListQueue(); linkedListQueue.Enqueue(56); linkedListQueue.Enqueue(30); linkedListQueue.Enqueue(70); linkedListQueue.Display(); linkedListQueue.Dequeue(); linkedListQueue.Display(); linkedListQueue.Dequeue(); linkedListQueue.Display(); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Welcome to Stack and Queue Operations"); LinkedListStack linkedListStack = new LinkedListStack(); //UC-1 Console.WriteLine("Pushing nodes in stack"); linkedListStack.Push(70); linkedListStack.Push(30); linkedListStack.Push(56); //UC-2 Console.WriteLine("Peek node"); linkedListStack.peek(); Console.WriteLine("Poping node from stack"); linkedListStack.Pop(); //UC3 Console.WriteLine(); Console.WriteLine("Queue Operation"); Queue queue = new Queue(); queue.Enqueue(56); queue.Enqueue(30); queue.Enqueue(70); //UC4 Console.WriteLine(); queue.Dequeue(); Console.WriteLine("After DeQueue Operation"); Console.WriteLine("Queue Front : " + queue.front.data); Console.WriteLine("Queue Rear : " + queue.rear.data); Console.ReadLine(); }
static void Main(string[] args) { LinkedListStack stack = new LinkedListStack(); stack.Push(10); stack.Push(20); stack.Push(45); stack.Push(67); stack.PeekAndPopUntilStackIsEmpty(); LinkedListQueue queue = new LinkedListQueue(); queue.Enqueue(20); queue.Enqueue(55); queue.Enqueue(76); queue.Dequeue(); }