We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4109c2f commit 95b496aCopy full SHA for 95b496a
linearsearch.py
@@ -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