Fixed Python2 vs Python3 division compatibility.

This commit is contained in:
Donne Martin
2015-07-06 06:44:35 -04:00
parent 9df39726c1
commit 40ef096ede

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* Is a naiive solution sufficient (ie not in-place)?\n",
" * Yes"
]
@@ -88,12 +87,14 @@
},
"outputs": [],
"source": [
"from __future__ import division\n",
"\n",
"def quick_sort(data):\n",
" if len(data) < 2:\n",
" return data\n",
" left = []\n",
" right = []\n",
" pivot_index = len(data) / 2\n",
" pivot_index = int(len(data) / 2)\n",
" pivot_value = data[pivot_index]\n",
" \n",
" # Build the left and right partitions\n",