Outline for February 20

Reading: text, §8
Due: Homework 4, due on March 4 at 11:55pm


  1. Modules
    1. import module imports file “module.py”; prefix methods defined there with “module.” to call them (eg, module.func())
    2. from module import func imports method “func()” from module; just call func(); don’t prefix it with “module.”
    3. from module import * imports all the methods, like the method above
    4. import module as m lets you write “m.func()” rather than “module.func()”
  2. Namespaces
  3. Searching
    1. What is it
    2. Why it is an important problem
  4. Linear search
    1. Look at each element
    2. Unordered list: as good as any [search-1c.py]
    3. Ordered list: go until you pass where the value would be [search-2c.py]
  5. Binary search
    1. Ordered list only: how it works
    2. Example [search-3c.py]
  6. Sorting
    1. Why it is important
    2. A bit of history

UC Davis seal
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email: [email protected]
You can also obtain a PDF version of this.
Version of February 20, 2019 at 11:55PM