We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2e0eee5 + 6bc8d1b commit 67f26d3Copy full SHA for 67f26d3
Data Strucrures/linear search in array
@@ -0,0 +1,8 @@
1
+def linearsearch(arr, x):
2
+ for i in range(len(arr)):
3
+ if arr[i] == x:
4
+ return i
5
+ return -1
6
+arr = ['t','u','t','o','r','i','a','l']
7
+x = 'a'
8
+print("element found at index "+str(linearsearch(arr,x)))
0 commit comments