[Tutor] Python and algorithms

C.T. Matsumoto c.t.matsumoto at gmail.com
Thu Feb 18 15:43:52 CET 2010


Kent Johnson wrote:
> On Thu, Feb 18, 2010 at 8:17 AM, C.T. Matsumoto <c.t.matsumoto at gmail.com> wrote:
>   
>> Kent Johnson wrote:
>>     
>
>   
>>> But is that what you are asking for, or are you trying to sharpen your
>>> problem-solving skills? Many progamming problems are solved by simple
>>> loops and data structures without explicitly using any algorithms that
>>> you would find in a book such as this.
>>>       
>> I'd say sharpening my problem solving skills. I thought that was often
>> tied to building an algorithm. The example Walter Prins provided I
>> thought fit what I was looking for.
>>     
>
> I don't see Walter Prins' example.
>
> It's true that solving a problem often involves creating an algorithm
> in a broad sense. The formal study of algorithms studies specific
> techniques and algorithms that have proven to be useful to solve many
> hard problems. In my experience most programming problems do not
> require use of these formal algorithms, at least not explicitly. Some
> are used by Python under the hood, for example dicts are hash tables,
> heapq is a priority queue, etc. It is very useful to know when to
> apply these but you don't have to understand the details of how they
> work.
>
> Unfortunately I can't point you to a good resource, maybe that would
> be a good project for me...
>
> Kent
>
>   
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().

T


More information about the Tutor mailing list