Questions on Using Python to Teach Data Structures and Algorithms

George Sakkis george.sakkis at
Thu Sep 28 02:49:44 CEST 2006

efrat wrote:

> 1. What exactly is a Python list? If one writes a[n], then is the
> complexity Theta(n)? If this is O(1), then why was the name "list"
> chosen? If this is indeed Theta(n), then what alternative should be
> used? (array does not seem suited for teaching purposes.)

Indexing for python lists is O[1]. Why shouldn't they be named lists ?

> 2. Suppose I have some file, and I'd like to incorporate it
> **into** part of an HTML page with nice syntax highlighting and all the
> shebang. Is there an easy way to do so?
> (Sorry, but any Google query involving "Python" and "HTML" (with any
> other additional terms) led to Python HTML processing libraries.)

Check out MoinMoin, it colorizes python as well as other languages and
text types:

> 3. Are there any useful links for Python/DSA education? I found "Data
> Structures and Algorithms with Object Oriented Design Patterns"
> ( It is a fine book,
> but it is unsuitable: my students are electrical-engineers, and barely
> know how to program; teaching them DSA, python, **and** stuff like the
> visitor pattern seems impossible.

"Beginning Python - From Novice to Professional" is approachable and
great as a textbook IMO. As a bonus, it covers up to python 2.4, which
very few existing books do.


More information about the Python-list mailing list