Skip to content

Added peekFront and peekBack functions #290

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 5 commits into from
Mar 31, 2018

Conversation

sahilb2
Copy link
Contributor

@sahilb2 sahilb2 commented Oct 28, 2017

Created two "peek" functions rather than one since it makes it easier to understand on how this queue actually functions.

Copy link
Contributor

@varunu28 varunu28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The peekBack fails in 1 case
If I insert 1,2,3 and then do a remove. The peekBack checks the inStack which is empty right now and tries to get the peek of an empty stack whereas all the elements have been transferred to outStack.
Please handle this case and also test few other borderline cases

@christianbender christianbender merged commit 03dad51 into TheAlgorithms:master Mar 31, 2018
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