Implementation of queue using stack
Describe the process how to implement the queue by using stack.
Expert
The queue can be implemented by using two stacks as:
a) The element is inserted in the queue by pushing it into the stack 1.
b) Element is extracted from the queue by popping it from the stack 2.
c) If the stack 2 is empty then all the elements presently in stack 1 are transferred to stack 2 however in the reverse order.
d) If the stack 2 is not empty simply pop the value from the stack 2.
Illustrates the disadvantages of circular linked list over linear linked list?
In a linked list how can I search for data?
Define does the minimum spanning tree of a graph provide the shortest distance among any two given nodes.
Does the minimum spanning tree of graph provide the shortest distance between any two specified nodes?
Define how to implement queue by using stack?
Briefly describe the term B tree?
Write down the various types of algorithms?
Illustrates the stack operation in briefly?
Describes the uses of Tree Database?
Elucidate any two merits using Single linked list over doubly linked list and vice-versa?
18,76,764
1934495 Asked
3,689
Active Tutors
1452416
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!