Skip to content

Commit d256880

Browse files
authored
Merge pull request #363 from NidhiChaurasia/patch-7
Linear_Search.py
2 parents b21cfd9 + 6301518 commit d256880

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# To implement Linear Search in python
2+
# Linearly search x in arr[]
3+
# If x is present then returning its location
4+
# else return -1
5+
def search(arr, x):
6+
for i in range(len(arr)):
7+
if arr[i] == x:
8+
return i
9+
return -1

0 commit comments

Comments
 (0)