Implement Stack Using Queues
Implement a LIFO stack using queues.
Statement
Given a Queue class with common operations such as enqueue()
, dequeue()
, and size()
, implement a Stack
class with push()
, pop()
, and isEmpty()
operations. The isEmpty()
function should return true
if the stack is empty and false
otherwise.
Note: If the stack is empty, the
pop()
function should return .
A stack is a data structure in which objects are inserted and removed according to the
push()
: Inserts an item at the top of the stack.pop()
: Removes an item from the top of the stack and returns it.
A queue is a data structure in which objects are inserted and removed according to the