Skip to content

Commit

Permalink
Merge 3e4dedc into 4a3cbb7
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwoogit committed Jun 5, 2018
2 parents 4a3cbb7 + 3e4dedc commit ae19175
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions algorithms/search/linear_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Linear search works in any array.
#
# T(n): O(n)
#

def linear_search(array, query):
length = len(array)
for i in range(length):
if array[i] == query:
return i

return -1

0 comments on commit ae19175

Please sign in to comment.