Skip to content

feat: add queue implementation using two stacks #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

ajeshds
Copy link
Contributor

@ajeshds ajeshds commented Jan 9, 2023

  • Added a Queue implementation with 2 Stacks.
  • The stacks used in the implementation are from the pre-existing stack implementation in stack.ts
  • Utilized the pre-existing tests for Queue.

Time Complexity

Operation Time Complexity
Enqueue O(1)
Dequeue Amortized O(1)
Peek Amortized O(1)

@raklaptudirm raklaptudirm merged commit da6b1a9 into TheAlgorithms:master Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants