Implement queue by using stack
Define how to implement queue by using stack?
Expert
A queue can be implemented with two stacks as follows:
a. An element is inserted within the queue through pushing this within stack 1
b. An element is extracted by the queue through popping this from the stack 2
c. When the stack 2 is empty then each element currently within stack 1 are transferred to stack 2 but within the reverse order
d. When the stack 2 is not empty only pop the value by stack 2.
What is the way to implement of traversal of a binary tree?
What is win-win spiral model?
Write down some of the limitations of arrays?
Illustrates the disadvantages of circular linked list over linear linked list?
By using a declaration statement how is memory reserved?
What are the uses of binary tree?
What are the areas wherein data structures are applied extensively?
What are the main uses of data structures?
Illustrates the difference between ARRAY and STACK?
What are the differences between Base case and Run-Time Stack?
18,76,764
1945142 Asked
3,689
Active Tutors
1425059
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!