Skip to content

Min max stack example#768

Open
Iinguistics wants to merge 7 commits into
algorithm-archivists:mainfrom
Iinguistics:min_max_stack_example
Open

Min max stack example#768
Iinguistics wants to merge 7 commits into
algorithm-archivists:mainfrom
Iinguistics:min_max_stack_example

Conversation

@Iinguistics

Copy link
Copy Markdown
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

leios commented Jan 2, 2021

Copy link
Copy Markdown
Member

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

ntindle commented Aug 28, 2021

Copy link
Copy Markdown
Member

[lang: javascript]

@github-actions github-actions Bot added the lang: javascript Javascript programming language label Aug 28, 2021

@henrikac henrikac left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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