From 68a20e35eb55d55c613c1ab321735a7f1609ffc4 Mon Sep 17 00:00:00 2001 From: Arctic Wolf Date: Thu, 19 Jul 2018 01:01:24 +0200 Subject: [PATCH] Update 01_binary_search.c (#74) --- 01_introduction_to_algorithms/c/01_binary_search.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/01_introduction_to_algorithms/c/01_binary_search.c b/01_introduction_to_algorithms/c/01_binary_search.c index e7038ac..2d72738 100644 --- a/01_introduction_to_algorithms/c/01_binary_search.c +++ b/01_introduction_to_algorithms/c/01_binary_search.c @@ -1,5 +1,4 @@ #include -#include int binarySearch(int[], int, int); @@ -19,7 +18,7 @@ int binarySearch(int list[], int item, int len) int high = len; while (low <= high) { - int mid = floor((low + high) / 2); //math.h floor + int mid = (low + high)/2; int guess = list[mid]; if (guess == item) @@ -35,5 +34,5 @@ int binarySearch(int list[], int item, int len) low = mid + 1; } } - return -1; //number not find + return -1; //number not found }