Java
Java copied to clipboard
[FEATURE REQUEST] <Implementation of Stack using Queues>
What would you like to Propose?
Hello, I would like to add the algorithm of implementation of Stack using Queues in java.
Issue details
Stack using Queues Algorithm
-
Initialization:
- Create two empty queues, let's call them
queue1
andqueue2
.
- Create two empty queues, let's call them
-
Push Operation:
- To push an element into the stack, enqueue the element to
queue1
. - Now pop all the elements from
queue2
until it becomes empty. - Swap the two queues.
- For the next push operation
queue1
becomesqueue2
and vice versa.
- To push an element into the stack, enqueue the element to
-
Pop Operation:
- pop the topmost element from
queue2
.
- pop the topmost element from
-
Top Operation:
- Peek and return the last element from
queue2
.
- Peek and return the last element from
Additional Information
I would like to add this Algorithm
Hi, I am interested in implementing this. Could you provide information on which file would you want this to be in?
Hi , I am interested in implementing Could you please assign this to me
Hi, I am interested in implementing this. Could you please assign this to me. I have the keen background in data structure and algorithm and currently i have solved more than 1000 problems on different platforms.
Hi, I am interested in implementing this. Could you please assign this to me. here's the sample of my work in the field : linktree
Hi, I am interested in implementing the above issue can you please assign it to me i'll upload the pr immediately
Hi @IndranjanaChatterjee , I raised the PR for this Please check and merge it.
Hello @IndranjanaChatterjee I am interested in covering this issue. Could you please assign this to me.
Hey @IndranjanaChatterjee I am interested in working on this issue, as this is part of my course assignment. Can you please assign me this issue?
Let's wait for #4794
what's
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!
Please reopen this issue once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!