Sorting
If you ever need to blow your brains about how to write a "fast" sort algorithm have a look at one posting by the timbot. Pythons builtin sort8) is now stable but martelli's D-S-U recepie is still intresting as it mite provide a faster way of doing "strange" sorts, read without passing sort() a new cmp function.
Another reference.
Binary search
binary search is easy as in python
1 import bisect
2 your_list.sort()
3 # insert new_element at index
4 insert = bisect.bisect(your_list, new_element)
5 your_list.insert(insert, new_element)
