Skip to content

Instantly share code, notes, and snippets.

@yasith
Created December 9, 2011 02:50
Show Gist options
  • Save yasith/1449920 to your computer and use it in GitHub Desktop.
Save yasith/1449920 to your computer and use it in GitHub Desktop.
CSC108 Dec. 2009 3
def reverse_linearsearch(v, L):
index = len(L) - 1
while index > -1 and L[index] != v:
index -= 1
return index
def find_all(v, L):
li = [reverse_linearsearch(v, L)]
while li[-1] != -1:
li.append(reverse_linearsearch(v, L[:li[-1]]))
return li[:len(li) - 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment