Recitation 1

From 6.006: Introduction to Algorithms
Revision as of 22:00, 30 January 2008 by Mathmike (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Python Lists

Basic list operations:

  • indexing
  • slicing/copying
  • concatenation
  • L.append() appends one element
  • L.extend() appends elements in a list
  • L.reverse()
  • L.sort(), in-place sort, vs. sorted(L), new sorted copy
  • L.pop() removes last element
  • L.pop(x) removes element x

Strings are like lists of chars, but are not mutable.

Document Distance

Overview of the code. See Document Distance.

Personal tools