Skip to content

Instantly share code, notes, and snippets.

@kirankumaramruthaluri
Last active January 25, 2017 20:57
Show Gist options
  • Save kirankumaramruthaluri/fa51e08ad8341eb0772e to your computer and use it in GitHub Desktop.
Save kirankumaramruthaluri/fa51e08ad8341eb0772e to your computer and use it in GitHub Desktop.
Linear search implementation - Python
#!/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