mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Fix pseudocode and test cases text
This commit is contained in:
parent
e0bde79ddd
commit
6ad8c29af9
|
@ -50,7 +50,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"## Test Cases\n",
|
"## Test Cases\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Empty stack -> None\n",
|
"* Empty stack -> empty stack\n",
|
||||||
"* One element stack\n",
|
"* One element stack\n",
|
||||||
"* Two or more element stack (general case)\n",
|
"* Two or more element stack (general case)\n",
|
||||||
"* Already sorted stack"
|
"* Already sorted stack"
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"## Test Cases\n",
|
"## Test Cases\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Empty stack -> None\n",
|
"* Empty stack -> empty stack\n",
|
||||||
"* One element stack\n",
|
"* One element stack\n",
|
||||||
"* Two or more element stack (general case)\n",
|
"* Two or more element stack (general case)\n",
|
||||||
"* Already sorted stack"
|
"* Already sorted stack"
|
||||||
|
@ -61,10 +61,10 @@
|
||||||
"source": [
|
"source": [
|
||||||
"## Algorithm\n",
|
"## Algorithm\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Our buffer will hold elements in reverse sorted order, smallest at the top\n",
|
"* Our buffer will hold elements in sorted order, largest at the top\n",
|
||||||
"* Store the current top element in a temp variable\n",
|
|
||||||
"* While stack is not empty\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 buffer top to stack\n",
|
||||||
" * Move temp to top of buffer\n",
|
" * Move temp to top of buffer\n",
|
||||||
"* Return buffer\n",
|
"* Return buffer\n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user