Skip to content

Commit 954e47c

Browse files
committed
Add search in array method
1 parent e60988f commit 954e47c

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/python-zulkarnain.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

array_1.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def search(arr, n, key):
2+
for i in range(n):
3+
if(arr[i] == key):
4+
return i
5+
6+
return -1
7+
8+
9+
arr = [2, 3, 4, 65, 67, 12]
10+
n = len(arr)
11+
key = 65
12+
idx = search(arr, n, key)
13+
14+
# if(idx != -1):
15+
# print('Element fount at position: ' + str(idx + 1))
16+
# else:
17+
# print('Element not found')
18+

data-structures/bog_o_notation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Big O Notation is used to measure how running time or space requirements for your
2+
# program grow as input size grows
3+

0 commit comments

Comments
 (0)