From 18907e4a072077108f33cc0b724ac273724631bd Mon Sep 17 00:00:00 2001 From: douly Date: Fri, 13 Apr 2018 09:56:40 +0800 Subject: [PATCH] fix type error (except an int) in jumpmp_search line 7. --- searches/jump_search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searches/jump_search.py b/searches/jump_search.py index 4cff92bb5..10cb933f2 100644 --- a/searches/jump_search.py +++ b/searches/jump_search.py @@ -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 @@ -23,4 +23,4 @@ def jump_search(arr, x): arr = [ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610] x = 55 index = jump_search(arr, x) -print("\nNumber " + str(x) +" is at index " + str(index)); \ No newline at end of file +print("\nNumber " + str(x) +" is at index " + str(index));