algorithm snippets available
David Eppstein
eppstein at ics.uci.edu
Thu Feb 28 19:22:47 EST 2002
I've been teaching the undergraduate algorithms course here at UCI this
quarter using Python syntax for my pseudocode (or, often, actual code) as
an experiment instead of the C/C++/Java syntax I'd used before.
Anyway, to help the students experiment with the algorithms, I've been
posting some implementations to my web site, and thought maybe others on
this list might find them interesting or useful. They're at
<http://www.ics.uci.edu/~eppstein/161/python/>.
Today's addition: kmp.py, a Knuth-Morris-Pratt string matcher.
Compared to using string.find or regular expressions, it allows the input
to be any kind of list or sequence (not just a string), and allows the
longer of the two inputs to be any kind of iterator rather than having to
be all in memory at once.
--
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list