Outline for February 20
Reading
:
text
, §8
Due
: Homework 4, due on March 4 at 11:55pm
Modules
import
module
imports file “module.py”; prefix methods defined there with “module.” to call them (eg,
module.func()
)
from
module
import
func
imports method “func()” from
module
; just call
func()
; don’t prefix it with “module.”
from
module
import *
imports all the methods, like the method above
import
module
as
m
lets you write “m.func()” rather than “module.func()”
Namespaces
Searching
What is it
Why it is an important problem
Linear search
Look at each element
Unordered list: as good as any [
search-1c.py
]
Ordered list: go until you pass where the value would be [
search-2c.py
]
Binary search
Ordered list only: how it works
Example [
search-3c.py
]
Sorting
Why it is important
A bit of history
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