From b0857f3017c91d2ebf6363603112f5bca21dd6c5 Mon Sep 17 00:00:00 2001 From: techieflutters <56913389+techieflutters@users.noreply.github.com> Date: Wed, 23 Oct 2019 23:55:20 +0530 Subject: [PATCH] else if update --- linearSearch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linearSearch.py b/linearSearch.py index 496a5ba..1955083 100644 --- a/linearSearch.py +++ b/linearSearch.py @@ -5,6 +5,12 @@ def func(arr,n, x): for i in range(0,n): if (arr[i] == x): return i + if(arr[mid] == x): + return mid + + #if not and value is greater than mid value ignore left part and increase its value + elif arr[mid] < x: + l = mid+1 return -1