Skip to content

Fix sort_stack pseudocode and test cases text #263

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stacks_queues/sort_stack/sort_stack_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"source": [
"## Test Cases\n",
"\n",
"* Empty stack -> None\n",
"* Empty stack -> empty stack\n",
"* One element stack\n",
"* Two or more element stack (general case)\n",
"* Already sorted stack"
Expand Down
8 changes: 4 additions & 4 deletions stacks_queues/sort_stack/sort_stack_solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"source": [
"## Test Cases\n",
"\n",
"* Empty stack -> None\n",
"* Empty stack -> empty stack\n",
"* One element stack\n",
"* Two or more element stack (general case)\n",
"* Already sorted stack"
Expand All @@ -61,10 +61,10 @@
"source": [
"## Algorithm\n",
"\n",
"* Our buffer will hold elements in reverse sorted order, smallest at the top\n",
"* Store the current top element in a temp variable\n",
"* Our buffer will hold elements in sorted order, largest at the top\n",
"* While stack is not empty\n",
" * While buffer is not empty or buffer top is > than temp\n",
" * Pop the current top element of stack into a temp variable\n",
" * While buffer is not empty and buffer top is > than temp\n",
" * Move buffer top to stack\n",
" * Move temp to top of buffer\n",
"* Return buffer\n",
Expand Down