Basic sorting algorithms in Python