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)


CategoryComputing and CategoryPython

Sorting (last edited 2008-03-27 13:54:16 by localhost)