# testing .ipynb diff#141

Closed
wants to merge 3 commits into from
Closed

# testing .ipynb diff #141

Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range

### Filter by extension

Filter by extension

##### Diff view
102 changes: 29 additions & 73 deletions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Expand Up @@ -30,7 +30,7 @@
"cell_type": "markdown",
"source": [
"Up to this point we have been concerned mainly with tools to access and operate on array data with NumPy.\n",
"Up to this point we have ever been concerned mainly with tools to access and operate on array data with NumPy.\n",
"This section covers algorithms related to sorting values in NumPy arrays.\n",
"These algorithms are a favorite topic in introductory computer science courses: if you've ever taken one, you probably have had dreams (or, depending on your temperament, nightmares) about *insertion sorts*, *selection sorts*, *merge sorts*, *quick sorts*, *bubble sorts*, and many, many more.\n",
"All are means of accomplishing a similar task: sorting the values in a list or array.\n",
Expand All @@ -41,26 +41,24 @@
{
"cell_type": "code",
"execution_count": 1,
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"import os\n",
"\n",
"def selection_sort(x):\n",
" for i in range(len(x)):\n",
" swap = i + np.argmin(x[i:])\n",
" (x[i], x[swap]) = (x[swap], x[i])\n",
" i += 1\n",
" (x[x], x[swap]) = (x[swap], x[i])\n",
" return x"
]
},
{
"cell_type": "code",
"execution_count": 2,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -92,9 +90,7 @@
{
"cell_type": "code",
"execution_count": 3,
"collapsed": false
},
"outputs": [],
"source": [
"def bogosort(x):\n",
Expand All @@ -106,9 +102,7 @@
{
"cell_type": "code",
"execution_count": 4,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -151,9 +145,7 @@
{
"cell_type": "code",
"execution_count": 5,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -181,9 +173,7 @@
{
"cell_type": "code",
"execution_count": 6,
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -208,9 +198,7 @@
{
"cell_type": "code",
"execution_count": 7,
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -237,9 +225,7 @@
{
"cell_type": "code",
"execution_count": 8,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -273,9 +259,7 @@
{
"cell_type": "code",
"execution_count": 9,
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -297,9 +281,7 @@
{
"cell_type": "code",
"execution_count": 10,
"collapsed": false
},
"outputs": [
{
"data": {
Expand All @@ -323,9 +305,7 @@
{
"cell_type": "code",
"execution_count": 11,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -365,9 +345,7 @@
{
"cell_type": "code",
"execution_count": 12,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -398,9 +376,7 @@
{
"cell_type": "code",
"execution_count": 13,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -444,9 +420,7 @@
{
"cell_type": "code",
"execution_count": 14,
"collapsed": false
},
"outputs": [],
"source": [
"X = rand.rand(10, 2)"
Expand All @@ -462,9 +436,7 @@
{
"cell_type": "code",
"execution_count": 15,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -496,9 +468,7 @@
{
"cell_type": "code",
"execution_count": 16,
"collapsed": false
},
"outputs": [],
"source": [
"dist_sq = np.sum((X[:, np.newaxis, :] - X[np.newaxis, :, :]) ** 2, axis=-1)"
Expand All @@ -514,9 +484,7 @@
{
"cell_type": "code",
"execution_count": 17,
"collapsed": false
},
"outputs": [
{
"data": {
Expand All @@ -538,9 +506,7 @@
{
"cell_type": "code",
"execution_count": 18,
"collapsed": false
},
"outputs": [
{
"data": {
Expand All @@ -562,9 +528,7 @@
{
"cell_type": "code",
"execution_count": 19,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -593,9 +557,7 @@
{
"cell_type": "code",
"execution_count": 20,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -623,9 +585,7 @@
{
"cell_type": "code",
"execution_count": 21,
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -661,9 +621,7 @@
{
"cell_type": "code",
"execution_count": 22,
"collapsed": false
},
"outputs": [],
"source": [
"K = 2\n",
Expand All @@ -680,9 +638,7 @@
{
"cell_type": "code",
"execution_count": 23,
"collapsed": false
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -773,9 +729,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}