Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Week 10 - Friday
What did we talk about last time?
Turing machines
Halting problem
Started review
Strings hold text
They are lists of characters (letters, digits,
punctuation, etc.)
A string literal in Python is text with either
single or double quotes around it
line = "Stop, collaborate, and listen!"
countdown = 'Launching in 5, 4, 3, 2, 1... Blast off!'
It doesn't matter which you use, but you can't
mix them in one string
You can use + to concatenate two strings
together (to get a third string that is both of
them stuck together)
place = "boon" + "docks"
print(place) #prints boondocks
You can use * to get repetitions of a string
comment = "yeah " * 3
print(comment) #prints yeah yeah yeah
You can use the len() function to get the length of a
string
author = "Thomas Pynchon"
print( len(author) ) #prints 14
You can use square brackets to get a particular character
in the string
Indexes start at 0
The first character in a string is at 0, the last is at its length - 1
movie = "Dr. Strangelove"
print(movie[4]) #prints S
If you want to get more than one character
from a string, you can use the slice notation
Two numbers with a colon (:) in between
The first number is the starting point, the second
number is the location after the ending point
If you subtract the first from the last, you'll get the
length of the result
adjective = "dysfunctional"
noun = adjective[3:6] #noun contains "fun"
You can think of a string as a list of characters
Python provides a way to make lists of other
things too
To make a list, you can put a collection of objects
inside square brackets
days = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"]
They can even be different types
stuff = ["Danger!", 3, True, 1.7]
As with strings, use square brackets and a
number to access an element in the list
days = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"]
bleh = days[0] #contains "Monday"
Like strings, elements are numbered from 0
to the length – 1
You can use the len() function to get the
length of a list
count = len(days)
#contains 7
You can also change the elements in a list
using the square bracket notation
birds = ["Duck", "Duck", "Duck"]
birds[2] = "Goose"
print(birds) #prints ['Duck', 'Duck', 'Goose']
This is one of the bigger differences between
strings and general lists
You cannot change the characters in a string
You have to make a new string
Just like strings, you can use the slice notation to
get a copy of part of a list
days = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"]
weekend = days[5:7]
print(weekend) #prints ['Saturday', 'Sunday']
There are shortcuts too
Python assumes 0 if you leave off the first number
It assumes the length if you leave off the last number
weekdays = days[:5] #Monday through Friday
A for loop can be used to iterate over all the
elements in a list
days = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"]
for day in days:
print( day ) #prints each day on a line
Since a string is a special kind of list, you can
iterate over the characters in them too
word = "HEY"
for letter in word:
print( letter ) #H E Y on separate lines
Sometimes you get a string that contains a lot of
words
You'd like to split the string up into a list of those
individual words so that you can deal with each
Calling the split(" ") method returns just
such a list, breaking apart the string wherever
there is a space character (" ")
sentence = "I seem to be having tremendous
difficulty with my lifestyle."
words = sentence.split(" ")
print(words[5])
#prints tremendous
print( len(words) ) #prints 10
For many reasons, we want to simulate the
real world inside of a computer
Reason
Example
Predict the future
Weather forecasting
Too dangerous to do
Observe how a disease spreads
Too expensive to test
Traffic engineering
Too hard to measure
Processes inside of cells
Education
A basketball bouncing in Scratch
Simulations are generally either stochastic or
deterministic
Stochastic means that it models a process with random
elements
Deterministic means that everything should behave the
same every time
Another way to categorize simulations is discrete or
continuous
Discrete event simulations view a process as a series of
events that happen at points in time
▪ Like people getting in line at McDonald's
Continuous simulations look at time as continuous
▪ Like the moon being pulled by the earth
Bioinformatics is using computer science to
analyze biological data
A number of important areas within
bioinformatics are:
Computational genetics and evolutionary biology
Literature analysis
Network and systems biology
Image analysis
Molecular interaction and protein structure
Artificial intelligence (AI) is hard to define
Trying to make machines think?
Goals
Problem solving
Representing knowledge
Creating machines that can learn
Natural language processing
Interpreting and interacting with the physical world and
humans
Creativity
General intelligence is perhaps the combination of all
these things
Achieving general intelligence is sometimes called strong AI
There are many approaches for generating
various aspects of artificial intelligence
Simulating the human brain
▪ Like with Blue Gene
Symbolic approaches
▪ Views all intelligence as manipulating symbols
Sub-symbolic approaches
▪ Became popular in the 1980s
▪ Tries to process data without directly manipulating symbols
Statistical approaches
Combinations
Neural networks are a popular
sub-symbolic tool
They are composed of simple nodes
that take numerical inputs and add
them together with different
weights
By adjusting the weights, you can
train a group of nodes to solve a
problem
There are handwriting
recognizers and speech
recognizers that use neural
networks
i
In the 1990s, statistical approaches became popular
For example, you can analyze language statistically
and
Find rarely used words, are some of them misspelled?
Find buzzwords
Link different search terms together
Know that this phrase in Farsi is almost always translated
into that phrase in English
Most of Google's success in AI has been statistical
Like neural networks, statistical models of how
speech (or other intelligent behavior) is formed tend
to give us little insight into how intelligence works
But they work!
Alan Turing, a great early computer scientist, argued
that acting like a human being was proof of
intelligence
In the Turing test, person A (call her Alice) texts with
entity B (call him Bob)
Bob could be a computer or a human
If a computer can reliably fool Alice into thinking is a
human, it is displaying human intelligence
Alice: Are you a human?
Bob: What else would I be?
Alice: Do you like pie?
Bob: The value of pi is approximately 3.141592
John Searle proposed an argument against symbolic AI
and the Turing test:
Imagine a room filled with rules to manipulate symbols
A man in the room receives symbols written on paper slipped
through a slot in the door
He follows the rules, creates new symbols, writes them on
paper, and slips them back out the slot
The symbols are actually Chinese characters
Because the rules are complex enough, the Chinese speaker on
the outside believes that she is interacting with someone who
understands Chinese
Does the man in the room understand Chinese?
Do our brains understand English or are they just
manipulating symbols?
Vertices (Nodes)
Edges
Friendships on
Facebook
Nodes: Subtasks
Edges: Decisions
Nodes: People
Edges: Friendship
Routes between cities
Nodes: Cities
Edges: Streets
Steps in a task
6 degrees of Kevin
Bacon
Nodes: Actors
Edges: Whether or not
they've been in a movie
together
Labeled
Weighted
Colored
Multigraphs
A
5
3
6
E
5
4
B
4
3
D
5
2
F
C
7
1
When a weighted graph obeys the triangle
inequality, the direct route to a node is always
fastest
No Triangle Inequality
Triangle Inequality
1
1
4
2
1
3
2
5
5
2
4
2
3
3
4
3
1
Some graphs have edges with direction
Example: One way streets
ONE WAY
Reachability?
A
E
B
D
F
C
Often we talk about connected graphs
But, not all graphs have to be connected
A path is a sequence of connected nodes
The cost or weight of the path is usually the sum
of the edge weights
A
5
6
3
E
4
D
5
F
3
2
7
C
B
4
3
This path from A to C costs 5
A cycle is a path that starts at a node and comes back
A
to the same node
E
B
D
F
C
How many cycles of length 3 does this graph have?
What about 4? 5? 6?
A tour is a path that visits every node and (usually)
returns to its starting node
In other words, it's a cycle that visits every node
A
5
6
3
E
4
D
5
F
This tour costs 24
B
4
3
3
2
7
C
A bipartite graph is one whose nodes can be
divided into two disjoint sets X and Y
There can be edges between set X and set Y
There are no edges inside set X or set Y
A graph is bipartite if and only if it contains no
odd cycles
X
A
B
C
D
E
F
Y
A
B
C
D
E
F
A perfect matching is when every node in set
X and every node in set Y is matched
It is not always possible to have a perfect
matching
We can still try to find a maximum matching
in which as many nodes are matched up as
possible
1.
2.
3.
4.
Come up with a legal, maximal matching
Take an augmenting path that starts at an
unmatched node in X and ends at an
unmatched node in Y
If there is such a path, switch all the edges
along the path from being in the matching
to being out and vice versa
If there is another augmenting path, go back
to Step 2
Anna
Becky
Caitlin
Daisy
Erin
Fiona
X
A
B
C
D
E
F
Y
A
B
C
D
E
F
Adam
Ben
Carlos
Dan
Evan
Fred
Consider two marriages:
Anna and Bob
Caitlin and Dan
This pair of marriages is unstable if
Anna likes Dan more than Bob and Dan likes Anna
more than Caitlin or
Caitlin likes Bob more than Dan and Bob likes
Caitlin more than Anna
We want to arrange all n marriages such that
none are unstable
n rounds
Each round, every unengaged man proposes
to the woman he likes best (who he hasn’t
proposed to already)
An unengaged woman must accept the
proposal from the one of her suitors she likes
best
If a woman is already engaged, she accepts
the best suitor only if she likes him better
than her fiance
Can you find a path that starts anywhere and
crosses each bridge exactly once
By simplifying the problem into a graph, the
important features are clear
To arrive as many times as you leave, the
degrees of each node must be even (except for
the starting and ending points)
North Shore
Center
Island
East
Island
South Shore
There is actually an way to find such a path on
a graph where one exists:
Start with a node of odd degree if there is one
Every time we move across an edge, delete it
If you have a choice, always pick an edge whose
deletion will not disconnect the graph
At the end of the algorithm, you will either
have an Eulerian path or an Eulerian cycle,
depending on the graph
An airline has to stop running direct flights
between some cities
But, it still wants to be able to reach all the
cities that it can now
What’s the set of flights with the lowest total
cost that will keep all cities connected?
Essentially, what’s the lowest cost tree that
keeps the graph connected?
This is called the minimum spanning tree
(MST) for a graph
1.
Start with two sets, S and V:
S has the starting node in it
V has everything else
2.
3.
4.
5.
Find the node u in V that is closest to any
node in S
Put the edge to u into the MST
Move u from V to S
If V is not empty, go back to Step 2
Let’s think more about weight on edges
Weight can represent time, distance, cost:
anything, really
The shortest path (lowest total weight) is not
always obvious
6
B
5
8
A
D
2
C
16
3
4
E
Take a moment and try to find the shortest
path from A to E
The shortest path has length 14
6
B
5
8
A
D
2
C
16
3
4
E
Start with two sets, S and V:
S has the starting node in it
V has everything else
Set the distance to all nodes in V to ∞
Find the node u in V that is closest to a node in S
For every neighbor v of u in V
▪ If d(v) > d(u) + d(u,v)
▪
Set d(v) = d(u) + d(u,v)
Move u from V to S
If V is not empty, go back to Step 2
Node
d(u)
Sets
A
0
S
V
B
5
A,A,A,
B,A,
B,A
C,
B,C,
BD,
CDE
B,C,C,
D,D,
ED,
EEE
C
87
D
10
11
∞
E
16
14
6
B
5
D
2
8
A
Finding the shortest
distance from A to all
other nodes
C
16
3
4
E
Often goes through phases similar to the
following:
1. Understand the problem
2. Plan a solution to the problem
3. Implement the solution in a programming
language
4. Test the solution
5. Maintain the solution and do bug fixes
Factor of 10 rule!
Radiation treatment machine for cancer patients
Used June 1985 - Jan 1987
Caused:
At least six serious overdoses
Several deaths
Many permanently maimed
Radiation treatment is normally around 200 rads
500 rads can be lethal
Therac-25 delivered dosages of over 20,000 rads because
of a software error
11 units in US and Canada had treated hundreds of
patients over the course of several years
Earlier Therac-20 and Therac-6 models had been in
service, without incident, for many years
Positive test cases
Cases that should work, and we can easily check
the answer
Boundary condition test cases
Special cases, like deleting the first or last item in
a list
Sometimes called "corner cases"
Negative test cases
Cases that we know should fail
One philosophy of testing is making black box
tests
A black box test takes some input A and knows
that the output is supposed to be B
It assumes nothing about the internals of the
program
To write black box tests, you come up with a set
of input you think covers lots of cases and you
run it and see if it works
In the real world, black box testing can easily be
done by a team that did not work on the original
development
White box testing is the opposite of black box
testing
Sometimes white box testing is called "clear box
testing"
In white box testing, you can use your
knowledge of how the code works to generate
tests
Are there lots of if statements?
Write tests that go through all possible branches
There are white box testing tools that can help
you generate tests to exercise all branches
Which is better, white box or black box testing?
Language
Description
Typing
C/C++
Fast and powerful systems language, prone to nasty bugs
Static
Java
Platform independent OO language, uses virtual machine
Static
Apple language for writing Mac, iPhone, and iPad apps
Static
Microsoft language for applications and the web, like Java
Static
Objective-C
C#
Python
Interpreted language with unusual syntax, easy to read
Dynamic
Perl
Scripting language, good at processing text
Dynamic
Ruby
Interpreted language, popular for making websites
Dynamic
PHP
Interpreted, C-like language that runs on web servers
Dynamic
Interpreted language that runs on web browsers
Dynamic
JavaScript
Visual Basic
SQL
Microsoft language, good at making GUIs
Static
Language for talking to databases
Static
We use a program called a compiler to turn a
high level language into a low level language
Usually, the low level language is machine
code
Python uses an interpreter instead of a
compiler
An interpreter runs the program line by line
instead of turning it into a machine code file
that the OS can run
Source
Code
Machine
Code
Computer!
Solve a
problem;
010101010
010100101
001110010
Hardware
Execute
Observation made by Gordon Moore, cofounder of Intel in a 1965 paper
The density of transistors on a CPU doubles every
18 months
The period of time has been debated
Historically, this has meant that CPU speeds
have also doubled every two years
We can’t make things much faster because of
heat and power
We can still put more “stuff” into a CPU
The growth of computer power has been so fast that
we have to describe it using a logarithmic scale
In a logarithmic scale, the y units are multiplied by a
power (often of ten) instead of linearly increasing
Logarithmic Scale
Linear Scale
1,000,000,000
1,000,000,000
900,000,000
100,000,000
800,000,000
10,000,000
700,000,000
1,000,000
600,000,000
100,000
500,000,000
10,000
400,000,000
1,000
300,000,000
200,000,000
100
100,000,000
10
0
1
1
3
5
7
9
1
3
5
7
9
Even though Moore's
Law has affected
speed, it's really
talking about the size
of transistors
Transistors are the
fundamental building
blocks of computer
chips
The smaller they get,
the more you can
pack into a small
space
Clock rate is misleading because some processors
take fewer clock cycles to perform the same
instructions
One trick for getting more speed is pipelining
Same as the trick of washing your second load while
drying your first load
Different architectures are different, but the steps to
perform an instruction are similar to:
Fetch instruction
Decode instruction
Execute instruction
Read from memory
Write back to memory
Instruction
1
Pipeline Stage
Fetch
2
Decode
Execute
Read
Write
Fetch
Decode
Execute
Read
Write
Fetch
Decode
Execute
Read
Write
Fetch
Decode
Execute
Read
Fetch
Decode
Execute
5
6
7
3
4
5
Clock Cycle
1
2
3
4
Even though computers are fast, they are never as
fast as we want
Parallel processing is the field within CS focused on
solving hard problems with multiple computers
Often it follows this pattern:
One computer breaks a problem into pieces
It sends the pieces to the other computers
Each computer completes its work independently
The computers send back their results to the master
computer
It assembles the partial answers into a final answer
Regular (non-parallel) computing is sequential
processing
The goal of parallel processing is speedup
Speedup is defined as
𝑡𝑖𝑚𝑒𝑠𝑒𝑞𝑢𝑒𝑛𝑡𝑖𝑎𝑙
𝑠𝑝𝑒𝑒𝑑𝑢𝑝 =
𝑡𝑖𝑚𝑒𝑝𝑎𝑟𝑎𝑙𝑙𝑒𝑙
In other words, how many times faster is
doing the job in parallel?
If you have n computers, what's the best
speedup you can hope for?
Is it ever possible to have a speedup less than
1?
Communication time is usually what stops speedup
from being very good
Another problem is that only part of a problem is
parallelizable
Amdahl's law states that if p is the fraction (between 0
and 1) of the program that can be parallelized, then
1
𝑠𝑝𝑒𝑒𝑑𝑢𝑝 <
1 −𝑝
Let's say that 75% of your program can be parallelized
Your speedup will never be greater than 4, even if you used
1,000,000 computers to solve your problem
Parallel processing used to be something that
only research scientists talked about
Owning multiple computers was expensive
Now, computers are cheap and virtually all
desktops and laptops have multicore
processors
A multicore processor has several
independent processors inside
Multicore processors bring the possibility of
parallel processing to the common person
An algorithm is a finite sequence of steps you
can follow to solve a problem
Long division is a good example
You can follow the steps and divide even very
large numbers
Algorithms are independent of programming
languages
One algorithm could be implemented in many
different languages
The algorithm to find a number in a list is
straightforward
We just look through every element in the list
until we find it or run out
def find( haystack, needle ):
for i in haystack:
if i == needle:
return True
return False
If we find it, we return True, otherwise we
return False
Measuring in seconds isn't really helpful
It depends on the length of the list
Let's say that the length of the list is n
How many numbers do we have to check in
the worst possible case?
We have to check n different numbers
A binary search is faster, but only works if the values
are in sorted order
Play a high-low game by repeatedly dividing the
search space in half
We’re looking for 37, let’s say
23
31
37
54
Check
Check
the
Check
middle
the
Check
middle
the middle
the middle
(Too(Too
low)
(Found
low)
(Tooit!)
high)
We cut the search space in half every time
At worst, we keep cutting n in half until we get 1
Let’s say x is the number of times we look:
1 x
n = 1
2
n = 2x
log n = x
It takes at most log n steps
The log operator is short for logarithm
Taking the logarithm means deexponentiating something
log 107 = 7
log 10𝑥 = 𝑥
What's the log 1,000,000 ?
In the normal world, when you see a log without a
subscript, it means the logarithm base 10
"What power do you have to raise 10 to to get this
number?"
In computer science, a log without a subscript usually
means the logarithm base 2
"What power do you have to raise 2 to to get this
number?"
log 28 = 8
log 2𝑦 = 𝑦
What's the log 2048? (Assuming log base 2)
The importance of sorting should be evident
to you by now
Applications:
Sorting a column in Excel
Organizing your iTunes playlists by artist name
Ranking a high school graduating class
Finding a median score to report on an exam
Countless others…
It is simple to understand
It is simple to code
It is not very fast
The idea is simply to go through your list,
swapping out of order elements until nothing
is out of order
Run through the
whole list, swapping
any entries that are
out of order
7
No swap
45
0
Swap
45
0
No swap
54
37
Swap
54
37
No swap
108
51
Swap
108
51
How bad could it be?
What if the list was in reverse-sorted
order?
One pass would only move the
largest number to the bottom
We would need n – 1 passes to sort
the whole list
6
7
6
57
4
75
4
37
273
217
71
The full Python function for bubble sort
would require us to have at least n – 1 passes
We'll do n, since it's simpler
def bubbleSort( list ):
for i in list: #n passes
for j in range( len(list) - 1):
if list[j] > list[j + 1]:
list[j], list[j + 1] =
list[j + 1], list[j]
We want to compare the running time of one
program to another
We want a mathematical description with the
following characteristics:
Worst case
We care mostly about how bad things could be
Asymptotic
We focus on the behavior as the input size gets
larger and larger
We want our description to take into account
the number of things we are taking as input
Sometimes that's the number of things in a
list
Sometimes that's the number of lines in a file
However many things we're processing, we'll
call it n
Any code that isn't inside of a loop takes
constant time
If a loop runs n times, then it takes n time
But that means that a loop that runs n times
which is inside another loop that runs n times
will take n2 time
And loops inside of loops inside of loops take n3
time, and so on
There are more complex situations (like
binary search), but we'll focus on simple ones
The notation we use for representing running
time is called Big Oh notation
It's goal is to simplify the expression so we can focus
on whatever grows the fastest
All constant coefficients are ignored
All low order terms are ignored
7n3 + 10n2 + 3n + 3 is O(n3)
Big Oh states that, ignoring constants, the
running time is no worse than some simple
function of n
147n3 + 2n2 + 5n + 12083 is
O(n3)
n1000 + 2n is
O(2n)
15n2 + 6n + 7log n + 145 is
O(n2)
659n + nlog n + 87829 is
O(n log n)
Note: In CS, we use log2 unless stated otherwise
How do we find the largest element in a list?
largest = numbers[0]
for i in numbers:
if i > largest:
largest = i
print("Largest:", largest)
Running time: O(n) if n is the length of the listt
What if the list is sorted in ascending order?
print("Largest:", numbers[len(numbers)-1]);
Running time: O(1)
What is the running time for bubble sort?
def bubbleSort( list ):
for i in list: #n passes
for j in range( len(list) - 1):
if list[j] > list[j + 1]:
list[j], list[j + 1] =
list[j + 1], list[j]
Running time: O(n2)
Here is a table of several different complexity
measures, in ascending order, with their
functions evaluated at n = 100
Description
Big Oh
f(100)
Constant
O(1)
1
Logarithmic
O(log n)
6.64
Linear
O(n)
100
Linearithmic
O(n log n)
664.39
Quadratic
O(n2)
10000
Cubic
O(n3)
1000000
Exponential
O(2n)
1.27 x 1030
Factorial
O(n!)
9.33 x 10157
The Eulerian Cycle problem asked if you
could start at some node, cross every edge
once, and return to the start
The Hamiltonian Cycle problem asks if you
can start at some node, visit every node only
once, and return to the start
In other words, find a tour
Sounds easy, right?
Finding a Hamiltonian cycle on this graph might even be
hard for a computer
Given a graph, find the shortest tour that
visits every node and comes back to the
starting point
Like a lazy traveling salesman who wants to
visit all possible clients and then return to his
home
TSP is an NP-complete problem
Find the shortest TSP tour:
Starts anywhere
Visits all nodes
Has the shortest length of such a tour
A
5
6
3
E
4
D
5
F
B
4
3
3
2
7
C
No one knows how to find the best solution
to TSP in an efficient amount of time
The best solutions known take O(2n)
For a general graph, no good approximation
even exists
For a graph with the triangle inequality, there
is an approximation that yields a tour no
more than 3/2 the optimal
Some variations on the problem are easier
than others
TSP is one of many problems which are called
NP-complete
All of these problems share the characteristic
that the only way we know to find best
solution uses brute force
All NP-complete problems are reducible to all
other NP-complete problems
An efficient solution to one would guarantee
an efficient solution to all
Find the smallest number of colors for coloring nodes such
that no two adjacent nodes have the same color
Like TSP and Hamiltonian Cycle, large graphs get really
hard to find the smallest coloring for
Graph coloring has many practical applications
A
E
B
D
F
C
Find the largest complete subgraph in a given
graph
This graph has a clique of size 3
Not all NP-complete problems are graph
problems
The knapsack problem is the following:
Imagine that you are Indiana Jones
You are the first to open the tomb of some long-lost
pharaoh
You have a knapsack that can hold m pounds of loot,
but there's way more than that in the tomb
Because you're Indiana Jones, you can instantly tell
how much everything weighs and how valuable it is
You want to find the most valuable loot that weighs
less than or equal to m pounds
This one is a little bit mathematical
Say you have a set of numbers
Somebody gives you a number k
Is there any subset of the numbers in your set that
add up to exactly k?
Example:
Set: { 3, 9, 15, 22, 35, 52, 78, 141}
Is there a subset that adds up to exactly 100?
What about 101?
NP is actually a class of problem
Problems in NP can be solved in polynomial
time on a non-deterministic computer
A deterministic computer is the kind you
know:
First it has to consider possibility A, then, it can
consider possibility B
A non-deterministic computer (which, as far
as we know, only exists in our imagination)
can consider both possibility A and possibility
B at the same time
A
B
Deterministic
C
A
NonDeterministic
B
D
E
F
C
D
E
F
P is the class of decision problems that can be
solved in polynomial time by a deterministic
computer
Lots of great problems are in P:
Is this list sorted?
Is this number prime?
Is the shortest path from node A to node B of length
37?
It's unknown whether some problems are in P:
Does this number have exactly two factors?
Is this graph equivalent to this other graph?
Everything in P is also in
NP
Some problems are the
“hardest” problems in NP
This means that any
problem in NP can be
converted into one of
these problem in
polynomial time
These problems make up
the class NP-complete
NPcomplete
NP
NPcomplete
P
Computer scientists view problems in P as
"easy to answer"
They can be computed in polynomial time
Problems in NP are "easy to check"
An answer can be checked in polynomial time
For example, if someone gives you a Traveling
Salesman tour, you can verify that it is a legal
tour of the required length
But is easy to check the same as easy to
answer?
Exam 2!
Keep working on Project 4
Turn in your Final Project Design Document
Due tonight before midnight!
Study for Exam 2