1,100 views
1 votes
1 votes
Hi please verify me

We can implement a stack using only one queue.

Like first insert into queue and for popping a element from stack dequeue n-1 element from queue and enque into queue and then pop last element and do the same each time......try it and verify that I am right or wrong?

1 Answer

1 votes
1 votes
please verify ur self first that when ur are doing n-1 dequeue where r u storing them .....nd now after popping desired element from where u r picking those n-1 elements to enqueing the into queue for further iterations.........................

Related questions

2 votes
2 votes
2 answers
2