Sorting algorithms in Python