Skip to content

Commit

Permalink
removed whitespace for easier copy paste
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLangmead committed Aug 23, 2015
1 parent c7e1f06 commit 0f028df
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions 3.01_EditDistanceDP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
" distDiag = editDistRecursive(x[:-1], y[:-1])\n",
" else:\n",
" distDiag = editDistRecursive(x[:-1], y[:-1]) + 1\n",
" \n",
" return min(distHor, distVer, distDiag)"
]
},
Expand All @@ -38,13 +37,11 @@
" D = []\n",
" for i in range(len(x)+1):\n",
" D.append([0]*(len(y)+1))\n",
" \n",
" # Initialize first row and column of matrix\n",
" for i in range(len(x)+1):\n",
" D[i][0] = i\n",
" for i in range(len(y)+1):\n",
" D[0][i] = i\n",
" \n",
" # Fill in the rest of the matrix\n",
" for i in range(1, len(x)+1):\n",
" for j in range(1, len(y)+1):\n",
Expand All @@ -54,9 +51,7 @@
" distDiag = D[i-1][j-1]\n",
" else:\n",
" distDiag = D[i-1][j-1] + 1\n",
" \n",
" D[i][j] = min(distHor, distVer, distDiag)\n",
" \n",
" # Edit distance is the value in the bottom right corner of the matrix\n",
" return D[-1][-1]"
]
Expand Down Expand Up @@ -110,21 +105,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 2",
"language": "python",
"name": "python3"
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0f028df

Please sign in to comment.