Merge pull request #283 from clobob/master

fix type error (except an int) in jumpmp_search line 7.
This commit is contained in:
Christian Bender 2018-04-13 15:36:36 +02:00 committed by GitHub
commit 0a1b6ad4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,11 +2,11 @@ from __future__ import print_function
import math
def jump_search(arr, x):
n = len(arr)
step = math.floor(math.sqrt(n))
step = int(math.floor(math.sqrt(n)))
prev = 0
while arr[min(step, n)-1] < x:
prev = step
step += math.floor(math.sqrt(n))
step += int(math.floor(math.sqrt(n)))
if prev >= n:
return -1