Last active
January 25, 2017 20:57
-
-
Save kirankumaramruthaluri/fa51e08ad8341eb0772e to your computer and use it in GitHub Desktop.
Linear search implementation - Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#======================================================================= | |
# Author: Amruthaluri Kiran Kumar ([email protected]) | |
# Title: Linear Search implementation | |
#======================================================================= | |
def linearSearch(list, item): | |
for j in list: | |
if item == j: | |
return True; | |
return False; | |
#============================== | |
# test sample | |
# | |
list = [31, 41, 59, 26, 41, 58]; | |
print linearSearch(list, 41); | |
# ./linearSearch.py | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment