Fixed Python2 vs Python3 division compatibility.

This commit is contained in:
Donne Martin 2015-07-06 06:44:09 -04:00
parent b57ca00bb2
commit 9df39726c1

View File

@ -33,7 +33,6 @@
"source": [
"## Constraints\n",
"\n",
"* Is a naiive solution sufficient?\n",
" * Yes"
]
@ -87,6 +86,9 @@
},
"outputs": [],
"source": [
"from __future__ import division\n",
"\n",
"\n",
"def merge(left, right):\n",
" l = 0\n",
" r = 0\n",
@ -111,7 +113,7 @@
"def merge_sort(data):\n",
" if len(data) < 2:\n",
" return data\n",
" mid = len(data) / 2\n",
" mid = int(len(data) / 2)\n",
" left = data[0:mid]\n",
" right = data[mid:len(data)]\n",
" left = merge_sort(left)\n",