From 6d05aedcbe7b6054017ca09ef9f0b4d935920e75 Mon Sep 17 00:00:00 2001 From: Linguistics Date: Mon, 6 Jul 2020 17:14:27 -0700 Subject: [PATCH 1/4] upstreaming --- styles/website.css | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/styles/website.css b/styles/website.css index 6176ff386..e2c84258e 100644 --- a/styles/website.css +++ b/styles/website.css @@ -15,3 +15,17 @@ img.center { margin-left: auto; margin-right: auto; } + +.search-results-item p{ + color: #4183C4; +} + +#book-search-results .search-results .has-results .search-results-item a { + color: #777; +} + + +#book-search-input input, #book-search-input input:focus, #book-search-input input:hover{ + color: #222; +} + From 78928386b0643594bcd39e4ca1be5ecd8b089204 Mon Sep 17 00:00:00 2001 From: Iinguistics <43329975+Iinguistics@users.noreply.github.com> Date: Mon, 6 Jul 2020 17:31:44 -0700 Subject: [PATCH 2/4] Update website.css --- styles/website.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/styles/website.css b/styles/website.css index 29188f9a7..e2c84258e 100644 --- a/styles/website.css +++ b/styles/website.css @@ -28,7 +28,4 @@ img.center { #book-search-input input, #book-search-input input:focus, #book-search-input input:hover{ color: #222; } -<<<<<<< HEAD -======= ->>>>>>> 691a7e4e1721c716e8e2c5ce3c7a7bfed07096b9 From 78a60fae028b1cd24eafe055ce484bc9b5bb5b7a Mon Sep 17 00:00:00 2001 From: Linguistics Date: Wed, 14 Oct 2020 16:05:40 -0700 Subject: [PATCH 3/4] added a min-max-stack construction class example in js --- .../code/javascript/min-max-stack.js | 33 +++++++++++++++++++ .../stacks_and_queues/stacks_and_queues.md | 11 +++++++ 2 files changed, 44 insertions(+) create mode 100644 contents/stacks_and_queues/code/javascript/min-max-stack.js diff --git a/contents/stacks_and_queues/code/javascript/min-max-stack.js b/contents/stacks_and_queues/code/javascript/min-max-stack.js new file mode 100644 index 000000000..967f90d16 --- /dev/null +++ b/contents/stacks_and_queues/code/javascript/min-max-stack.js @@ -0,0 +1,33 @@ +class MinMaxStack { + constructor(){ + this.minMaxStack =[]; + this.stack = []; + } + peek(){ + return this.stack[this.stack.length -1]; + } + + pop(){ + this.minMaxStack.pop(); + return this.stack.pop(); + } + + push(number){ + const newMinMax = { min:number, max:number }; + if(this.minMaxStack.length){ + const lastMinMax = this.minMaxStack[this.minMaxStack.length-1]; + newMinMax.min = Math.min(lastMinMax.min, number); + newMinMax.max = Math.max(lastMinMax.max, number); + } + this.minMaxStack.push(newMinMax); + this.stack.push(number); + } + + getMin(){ + return this.minMaxStack[this.minMaxStack.length-1].min; + } + + getMax(){ + return this.minMaxStack[this.minMaxStack.length-1].max; + } +}; \ No newline at end of file diff --git a/contents/stacks_and_queues/stacks_and_queues.md b/contents/stacks_and_queues/stacks_and_queues.md index 17b8b75b2..b01687754 100644 --- a/contents/stacks_and_queues/stacks_and_queues.md +++ b/contents/stacks_and_queues/stacks_and_queues.md @@ -13,6 +13,17 @@ For the most part, though, queues and stacks are treated the same way. There mus The notation for this depends on the language you are using. Queues, for example, will often use `dequeue()` instead of `pop()` and `front()` instead of `top()`. You will see the language-specific details in the source code under the algorithms in this book, so for now it's simply important to know what stacks and queues are and how to access elements held within them. +## Example Code + +{% method %} +{% sample lang="js" %} +[import, lang:"javascript"](code/javascript/min-max-stack.js) +{% endmethod %} + + + ## License ##### Code Examples From 45dbd6083b092eb464b96469c9dc4eea48311d30 Mon Sep 17 00:00:00 2001 From: Iinguistics <43329975+Iinguistics@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:15:39 -0700 Subject: [PATCH 4/4] Update website.css --- styles/website.css | 1 - 1 file changed, 1 deletion(-) diff --git a/styles/website.css b/styles/website.css index e2c84258e..4853a7a2d 100644 --- a/styles/website.css +++ b/styles/website.css @@ -28,4 +28,3 @@ img.center { #book-search-input input, #book-search-input input:focus, #book-search-input input:hover{ color: #222; } -