Implementing some of the sort algorithms in Python