Advertisement
Guy_Lalonde

CS101 Starred problem 3

Jul 19th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def ordered_search(index, ranks, keyword):
  2. index2= lookup(index,keyword)
  3. listA, listB, listC, listD = [],[],[], []
  4. print index2
  5. if len(index2)>1:
  6. pivot= ranks[index2[0]]
  7. for item in index2:
  8. if ranks[item]< pivot:
  9. listA.append(item)
  10. if ranks[item]== pivot:
  11. listB.append(item)
  12. if ranks[item]> pivot:
  13. listC.append(item)
  14.  
  15. else:
  16. return index
  17. return ordered_search(listA, ranks,keyword)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement