-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
base: main
Are you sure you want to change the base?
Min max stack example #768
Conversation
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. |
[lang: javascript] |
There was a problem hiding this 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(){ |
There was a problem hiding this comment.
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?
Added a stack class example in js & added imported the code into the md file.