Questions on Using Python to Teach Data Structures and Algorithms

Wayne Brehaut wbrehaut at mcsnet.ca
Wed Nov 7 23:49:15 CET 2007


On Thu, 28 Sep 2006 17:32:06 +0200, Fredrik Lundh
<fredrik at pythonware.com> wrote:

>Ramon Diaz-Uriarte wrote:
>
>> Going back to the original question, a related question: does anybody
>> know why there are so few books on data structures and algorithms that
>> use Python?
>
>Probably because Python has "better than textbook" implementations of 
>core structures, and "better than textbook" implementations of many core 
>algorithms, so lots of things can be done more efficiently by combining 
>existing structures and algorithms than by using "textbook" algorithms.

But this answers a diiferent question: university and (academic)
college data structure courses don't care how efficient a particular
language's built-in data structures are, since the intent is for the
students to learn how to implement data structures in general, and
probably in a particular language--the "core" languasge used in their
core programs--and then be able to apply that knowledge and skill to
implementing at least "reasonably efficient" ones when they need to in
languages that don't have any to speak of built in.

And, since many students will go direct to business or industry, and
may even be apprenticing there in "co-op work terms" during their
education, most could care less how efficient Python's built-in data
structures are.

Also,  it's a very rare DSA text that intends its DS code to be used
directly--especially  in "serious" applications. Preiss's texts, noted
by the OP, are one exception, and many could be used "out of the box"
in industrial strength applications.

So far as "combining existing structures" is concerned, it's highly
unlikely that any such combination of linear structures could be more
efficient in both--if either--storage and running time than one
specifically designed and implemented for non-linear structures, such
as (many) trees and algorithms on them. For general graphs efficient
list processing may be sufficient for an adjacncy structure for the
graph itself, of course, but how does that translate to storing a
subtree found using a DFS, for example, and efficiently processing it
in some way?

For learning DSA it's more important to have a clear, well-written and
well-documented implementation in a language of interest (again,
especially, the core language in one's programs) than just "using" or
even inspecting and trying to learn subtle details of some particular
implementation of a related DS or A in some "other" language.

How many of those who devleoped and improved  the very efficient data
structures in Python learned and honed their skills in Python (vs. C
or Pascal, for example)?

wwwayne

></F>



More information about the Python-list mailing list