Searching
From Algorithmist
| This is a stub or unfinished. Contribute by editing me. |
Searching algorithms are analagous to sorting algorithms. A typical search algorithm involves searching a pre-defined list or array for a desired element and returning the index of that element.
def linearSearch(list,key):
idx = -1
for i in range(len(list)):
if(list[i] == key):
idx = i
return idx

