Tweaked insertion sort challenge.

This commit is contained in:
Donne Martin 2015-07-03 20:07:56 -04:00
parent 08e884c9f7
commit 9eb9ed637a
2 changed files with 32 additions and 9 deletions

View File

@ -4,7 +4,14 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"<small><i>This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://bit.ly/code-notes).</i></small>" "<small><i>This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/coding-challenges).</i></small>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Challenge Notebook"
] ]
}, },
{ {
@ -17,7 +24,8 @@
"* [Test Cases](#Test-Cases)\n", "* [Test Cases](#Test-Cases)\n",
"* [Algorithm](#Algorithm)\n", "* [Algorithm](#Algorithm)\n",
"* [Code](#Code)\n", "* [Code](#Code)\n",
"* [Unit Test](#Unit-Test)" "* [Unit Test](#Unit-Test)\n",
"* [Solution Notebook](#Solution-Notebook)"
] ]
}, },
{ {
@ -26,7 +34,7 @@
"source": [ "source": [
"## Constraints\n", "## Constraints\n",
"\n", "\n",
"*Problem statements are often intentionally ambiguous. Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n", "*Problem statements are sometimes ambiguous. Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n",
"\n", "\n",
"* Is a naiive solution sufficient?\n", "* Is a naiive solution sufficient?\n",
" * Yes" " * Yes"
@ -49,7 +57,7 @@
"source": [ "source": [
"## Algorithm\n", "## Algorithm\n",
"\n", "\n",
"Refer to the solution notebook. If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start." "Refer to the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/coding-challenges/blob/master/sorting_searching/insertion_sort/insertion_sort_solution.ipynb). If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start."
] ]
}, },
{ {
@ -78,7 +86,7 @@
"source": [ "source": [
"## Unit Test\n", "## Unit Test\n",
"\n", "\n",
"*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand. You generally will not be asked to write a unit test like what is shown below.*\n", "\n",
"\n", "\n",
"**The following unit test is expected to fail until you solve the challenge.**" "**The following unit test is expected to fail until you solve the challenge.**"
] ]
@ -119,6 +127,15 @@
" test = TestInsertionSort()\n", " test = TestInsertionSort()\n",
" test.test_insertion_sort()" " test.test_insertion_sort()"
] ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Solution Notebook\n",
"\n",
"Review the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/coding-challenges/blob/master/sorting_searching/insertion_sort/insertion_sort_solution.ipynb) for a discussion on algorithms and code solutions."
]
} }
], ],
"metadata": { "metadata": {

View File

@ -4,7 +4,14 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"<small><i>This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://bit.ly/code-notes).</i></small>" "<small><i>This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/coding-challenges).</i></small>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Solution Notebook"
] ]
}, },
{ {
@ -26,7 +33,7 @@
"source": [ "source": [
"## Constraints\n", "## Constraints\n",
"\n", "\n",
"*Problem statements are often intentionally ambiguous. Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n", "*Problem statements are sometimes ambiguous. Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n",
"\n", "\n",
"* Is a naiive solution sufficient?\n", "* Is a naiive solution sufficient?\n",
" * Yes" " * Yes"
@ -96,8 +103,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Unit Test\n", "## Unit Test\n",
"\n", "\n"
"*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand. You generally will not be asked to write a unit test like what is shown below.*"
] ]
}, },
{ {