CS 161 (Homework 2 : R-4.17, R-5.11, C-6.1, A-6.8)
Ney Congjuico
R-4.17
For each of the following statements about wavl trees, determine whether it is true or false. If you think it is true,
provide a justication. If you think it is false, give a countere
CS 161
Problems: R-13.4, R-13.12, C-14.2, C-14.4
R-13.4 Bob loves foreign languages and wants to plan his course schedule to take the
following nine language courses: LA15, LA16, LA22, LA31, LA32, LA126, LA127, LA141,
and LA169. The course prerequisites a
CS 161 Homework 1
Problems: R-1.3, R-1.4, R-1.7, R-1.10
R-1.3: Algorithm A uses 10n log n operations, while algorithm B uses n^2 operations.
Determine the value n0 such that A is better than B for n n0.
10nlogn <= n^2
10logn <= n
If n = 1 2 4 8 16 32 64
A
CS 161
Problems: R-8.5, C-8.10, R-9.5, C-9.1
R-8.5 Consider again the modification of the deterministic version of the quick-sort algorithm so
that, instead of selecting the last element in an n-element sequence as the pivot, we choose the
element at inde
CS 161
Homework 4: R-11.4, R-24.5, R-24.10, C-24.8
R-11.4 A complex number a + bi, where i = 1, can be represented by the pair (a, b). Describe
a method performing only three real-number multiplications to compute the pair (e, f)
representing the product
CS 161
Problems: R-4.17, R-5.11, C-6.1, A-6.8
R-4.17 For each of the following statements about wavl trees, determine whether it is
true or false. If you think it is true, provide a justification. If you think it is false,
give a counterexample.
a. A subt
Breadth-First Search
5/7/2002 11:06 AM
Outline and Reading
Breadth-first search (6.3.3)
Breadth-First Search
Algorithm
Example
Properties
Analysis
Applications
L0
L1
A
B
C
L2
E
D
DFS vs. BFS (6.3.3)
F
Comparison of applications
Comparison of edge labels
5
FFT
11/27/2002 1:42 AM
Outline and Reading
Polynomial Multiplication Problem
Primitive Roots of Unity (10.4.1)
The Discrete Fourier Transform (10.4.2)
The FFT Algorithm (10.4.3)
Integer Multiplication (10.4.4)
Java FFT Integer Multiplication (10.5)
The Fa
Graphs
3/17/2005 2:11 AM
Outline and Reading
Graphs (6.1)
Graphs
1843
337
43
17
LAX
1233
ORD
802
SFO
Data structures for graphs (6.2)
DFW
Graphs
A vertex represents an airport and stores the three-letter airport code
An edge represents a flight route betw
Graphs
6/3/2002 1:41 PM
Outline and Reading
P and NP (13.1)
NP-Completeness
x1
x1
x2
x2
12
x3
x3
x4
22
x4
NP-completeness (13.2)
32
11
13
21
23
31
1
Running Time Revisited
NP-Completeness
2
Dealing with Hard Problems
Input size, n
To be exact, let n denot
Maximum Flow
5/13/2002 5:09 PM
Outline and Reading
Flow networks
Maximum Flow
v
4/6
3/3
s
w
1/1
3/5
u
5/13/2002 5:09 PM
Maximum flow
3/3
1/1
t
4/7
1/9
3/5
2/2
Maximum Flow
1
A weighted digraph G with nonnegative integer edge weights,
where the weight of a
R-1.2 Show that the MaxsubSlow algorithm runs in (n3) time.
To prove this question is equal to prove that n^3 is run time of Maxsubslow.
Quote from piazza: To show it's Big Omega, it would be nice if you could show that each of the
3 for-loops runs in at