how is the last element of stack being the “most recently added element” in the queue?
Stack using queue push efficient
in a queue it follows fifo and stack follows lifo
so if 1 2 3 4 are put in a stack they can be accessed in the order 4 3 2 1
whereas in a queue they are accessed as 1 2 3 4
by this we can say last element of stack namely 4 is the most recently added in the queue, how? since in a stack the last element is the one that is accessed first and the most recently added element is the one which will accessed last for a queue which are same
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.