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.
1 parent 5419a32 commit 6bc8d1bCopy full SHA for 6bc8d1b
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