A programmer is a person who passes as an exacting expert on the basis of being able to turn out, after innumerable punching, an infinite series of incomprehensive answers calculated with micrometric precisions from vague assumptions based on debatable figures taken from inconclusive documents and carried out on instruments of problematical accuracy by persons of dubious reliability and questionable mentality for the avowed purpose of annoying and confounding a hopelessly defenseless department that was unfortunate enough to ask for the information in the first place. Grid newsmagazine

Queue Using Stack

Language Java | Level Intermediate | Category Data structure | August 30, 2015 5:07 pm


Data structure Description

A queue can be implemented using two stacks. The queue supports enqueue and dequeue operations using head and tail nodes.

Write a program to implement the queue using two stacks.


Output

   					 
Enqueue itmes to the queue: [hello, kid, test]
Size of the Queue: 3
Items in the Queue: [hello, kid, test]
Dequeue itme from queue: hello
Dequeue itme from queue: kid
Items in the Queue: [test]

				    

Comments


No comments available!

Please login to add comments.