Questions on Using Python to Teach Data Structures and Algorithms

George Sakkis george.sakkis at gmail.com
Wed Sep 27 20:49:44 EDT 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 example.py, 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: http://moinmoin.wikiwikiweb.de/HelpOnFormatting

> 3. Are there any useful links for Python/DSA education? I found "Data
> Structures and Algorithms with Object Oriented Design Patterns"
> (http://www.brpreiss.com/books/opus7/html/book.html). 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.

George




More information about the Python-list mailing list