mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 16:38:02 +00:00
Fixed Python2 vs Python3 division compatibility.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user