CS 228 Exam 2 – November 21, 2005
Name
______________________
Relations |
reflexive |
symmetric |
transitive |
irreflexive |
anti-symmetric |
{(1,1), (1,2), (2,1), (2,2), (3,3), (4,4)} |
xx |
xxx |
xx |
|
|
{(2,4), (4,2)} |
|
xxx |
|
xxx |
|
{(1,3), (1,4), (2,3), (2,4), (3,1), (3,4)} |
|
|
|
xxx |
|
A
= {2,4,5}
B
= {2,4,5,8}
R1
= { (2,2), (4,4), (5,5)}
R2
= {(2,2), (2,4), (2,5), (2,8)}
Complete the table
below
R1
∩ R2 |
{(2.2)} |
R1
Ụ R2 |
{(2,2), (2,4),(2,5), (2,8), (5,5), (4,4)} |
R1
–
R2 |
{ (4,4), (5,5)} |
R2
–
R1 |
{ (2.4), (2,5), (2,8)} |
because it is the only attribute that is guaranteed to be unique. People can have the same name, the same street address, live in the same city and the same state.
Part-Number |
Project |
Quantity |
Color-Code |
1001 |
1 |
14 |
8 |
1092 |
1 |
2 |
2 |
1101 |
3 |
1 |
1 |
3477 |
2 |
25 |
2 |
4975 |
3 |
6 |
2 |
6984 |
4 |
10 |
1 |
9048 |
4 |
12 |
2 |
9191 |
2 |
80 |
4 |
|
|
|
|
|
|
|
|
3477 |
2 |
25 |
2 |
9191 |
2 |
80 |
4 |
(6
points)
A
relation on a set A is called an equivalence relation if it is reflexive,
symmetric and transitive
{(1,2),
(1,3), (1,4), (2,1), (2,3), (2,4), (3,1), (3,2), (3,4), (4,1), (4,2), (4,3)}
|
1 |
2 |
3 |
4 |
1 |
0 |
1 |
1 |
1 |
2 |
1 |
0 |
1 |
1 |
3 |
1 |
1 |
0 |
1 |
4 |
1 |
1 |
1 |
0 |
2
|
4
|
6
|
8
|
10
{ (a,a), (b,b), (c,c), (d,d), (e,e), (a,b),
(a,c), (a,e), (a,d), (b,e), (c,d), (c,e)}
any of the following: a b c d e a c d b e a c b e d a b c e d
4 time periods
are needed. A possible schedule would
pair: 1 and 5, 2 and 6,
4 and 7, and have 3 by itself.
|
an euler path |
path or circuit
shown here if one exists |
|
a |
|
yes |
beabcde,
ebcdeab, ebaedcb, bedcbae, baebcde,
bcdeabe are all Euler paths |
b |
yes |
|
dbafadefbcecd,
abcedcefadbfa, fafbadbcecdef,fabfececbcdaf, abcecdefafbda,
cedcbdabfafec, afecbdcedafba
, afabcdbfeceda are
all Euler circuits |
a.
b.
12.
Given the graph below
isolated
vertex |
g |
pendant
vertex |
d or a |
maximum
valence |
4 |
number
of edges |
8 |
number
of vertices |
7 |
b. is the graph above connected? _No_______ Why or why not? (5 points)
No it is not connected. There is no path from any vertex to g.
c. Add the edges to the graph below that would be needed to turn it into a complete graph? (5 points)
13. Show the state table or diagram (your choice) for a finite-state machine for a toll machine that opens a gate after 25 cents in nickels, dimes, or quarters has been deposited. No change is given for overpayment and no credit is given to the next driver when more than 25 cents has been deposited. (10 points)
Current State |
Input |
Next State |
Gate |
S0 |
5 |
S5 |
0 |
S0 |
10 |
S10 |
0 |
S0 |
25 |
S0 |
1 |
S5 |
5 |
S10 |
0 |
S5 |
10 |
S15 |
0 |
S5 |
25 |
S0 |
1 |
S10 |
5 |
S15 |
0 |
S10 |
10 |
S20 |
0 |
S10 |
25 |
S0 |
1 |
S15 |
5 |
S20 |
0 |
S15 |
10 |
S0 |
1 |
S15 |
25 |
S0 |
1 |
S20 |
5 |
S0 |
1 |
S20 |
10 |
S0 |
1 |
S20 |
25 |
S0 |
1 |