CS 173, Fall 2014
Examlet 6, Part B
NETID:
FIRST:
LAST:
Discussion:
Thursday
2
C
B
A
3
4
5
Friday
9
10 11
12
1
2
F
E
D
G
H
K
1. (8 points) Recall that a path never re-uses a node. How many paths are there from A to G in the
above graph? Explain or show wo
CS 173, Fall 2014
Examlet 4, Part B
NETID:
FIRST:
Discussion:
LAST:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (5 points) Check all boxes that correctly characterize this relation on the set cfw_A, B, C, D, E, F
B
C
D
E
F
Irreexive:
Symmetric:
A
Reexive:
CS 173, Fall 2014
Examlet 2, Part B
NETID:
FIRST:
LAST:
Discussion:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (5 points) Let a and b be integers, b > 0. We used two formulas to dene the quotient q and the
remainder r of a divided by b. One of these is a =
Examlet 3, Part A
NETID:
FIRST:
Discussion:
1. (4 points)
LAST:
Thursday
A = cfw_fox, cat
2
3
4
5
Friday
B = cfw_3, 4
9
10 11
12
1
2
C = cfw_3, 7
A (B C) = A cfw_3 = cfw_(f ox, 3), (cat, 3)
AB =
2. (4 points) Check the (single) box that best characterizes
CS 173, Fall 2014
Examlet 8, Part B
NETID:
FIRST:
Discussion:
LAST:
Thursday
2
3
4
5
Friday
9
10 11
12
1
(10 points) Suppose we have a function f dened by
f (1) = 5
f (n) = 3f (n 1) + n2 for n 2
Express f (n) in terms of f (n 3) (where n 4). Show your wor
CS 173, Fall 2014
Examlet 7, Part B
NETID:
FIRST:
LAST:
Discussion:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (9 points) What is the chromatic number of graph G (below)? Justify your answer.
g
h
d
e
R
G
G
k
B
a
c
G
R
B
f
R
B
b
Solution: The chromatic numb
1
CS 173, Fall 2014
Examlet 5, Part B
NETID:
FIRST:
Discussion:
LAST:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (5 points) Complete this picture to make an example of a function that is onto but not one-to-one,
by adding elements to the domain and arrows
CS 173, Fall 2014
NETID:
Examlet 10, Part B
FIRST:
LAST:
Discussion:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (9 points) Fill in key facts about the recursion tree for T , assuming that n is a power of 2:
T (4) = 7
T (n) = 5T
n
2
+n
(a) The height: log2
1
CS 173, Fall 2014
NETID:
Examlet 12, Part B
FIRST:
Discussion:
LAST:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
(a) (9 points) Suppose that A is a set and P is a collection of subsets of A. Using precise language
and/or notation, state the conditions P must
1
CS 173, Fall 2014
NETID:
Examlet 11, Part B
FIRST:
Discussion:
LAST:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
(15 points) Check the (single) box that best characterizes each item.
The running time of the
Towers of Hanoi solver
(log n)
The running time of
1
CS 173, Fall 2014
Examlet 9, Part B
NETID:
FIRST:
LAST:
Discussion:
Thursday
2
3
4
5
Friday
9
10 11
12
1
2
1. (8 points) Here is a grammar, with start variable S and terminals a and c. Circle the trees that
match the grammar.
S
S
c
SSa | cS | cc
S
c
S