[Tutor] Python and algorithms

Kent Johnson kent37 at tds.net
Thu Feb 18 16:07:38 CET 2010


On Thu, Feb 18, 2010 at 9:43 AM, C.T. Matsumoto <c.t.matsumoto at gmail.com> wrote:

> Here is the example.
>
> "To keep this simple and practical, as a suggestion, consider the problem of
> sorting a list (a pack of cards, or a list of names or whatever you want)
> into order."
>
> Yes, there are many built-ins that wrap good algorithms, so I guess I'm
> leaning more toward problem solving. The above example must be solved
> without using sorted() or list.sort().

To solve this without using the built-in sort then you will be
learning about sorting which is a major portion of the study of
algorithms.

So, if you want to learn about sorting algorithms, this is a good
problem to ponder. If you want to learn to be a better Python
programmer, I'm not sure it is helpful - the built-in sort is
excellent and you should be learning how to use it effectively, for
example, given a list of (first name, last name) print the list sorted
by first name, then sorted by last name.

Kent


More information about the Tutor mailing list