Skip to content

Commit 95b496a

Browse files
Add files via upload
1 parent 4109c2f commit 95b496a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

linearsearch.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def linear(arr , target):
2+
for i in range(len(arr)):
3+
if arr[i] == target :
4+
return i
5+
return -1
6+
arr = [12 , 3 , 4, 5 , 6 , 2]
7+
target = 4
8+
result = linear(arr , target)
9+
print("element found at index :",result)
10+

0 commit comments

Comments
 (0)