General Stack Using Queue Implemented

How to implement a stack using queue?   

Mustakim raheem
@[email protected] | Updated 19 Dec. 2018

A stack can be implemented using two queues. Let stack to be implemented be ‘s’ and queues used to implement be ‘q1’ and ‘q2’. Stack ‘s’ can be implemented in two ways: Method 1 (By making push operation costly) Method 2 (By making pop operation costly)