Skip to content
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

Min max stack example #768

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Iinguistics
Copy link
Contributor

Added a stack class example in js & added imported the code into the md file.

@berquist berquist added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) Hacktoberfest The label for all Hacktoberfest related things! labels Oct 15, 2020
@leios
Copy link
Member

leios commented Jan 2, 2021

I do intend to eventually add code to this chapter, so this PR is a good idea in principle; however, I don't know enough JS to say whether this is a good, fundamental implementation of a stack or queue in that language.

right now, my understanding is that this code goes a bit futher to allow for outputing the maximum or minimum element in the stack, which is useful, but not what I was thinking of for this chapter.

@ntindle
Copy link
Member

ntindle commented Aug 28, 2021

[lang: javascript]

@github-actions github-actions bot added the lang: javascript Javascript programming language label Aug 28, 2021
Copy link
Contributor

@henrikac henrikac left a comment

Choose a reason for hiding this comment

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

The indentation is not consistent in MixMaxStack but this should be a quick fix :)

this.minMaxStack =[];
this.stack = [];
}
peek(){
Copy link
Contributor

Choose a reason for hiding this comment

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

This chapter uses the words top and front for stacks and queues. Maybe rename peek to top to use the same words as used in the chapter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest The label for all Hacktoberfest related things! hacktoberfest-accepted Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: javascript Javascript programming language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants