Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Name: Khatri ID:11013702

Announcement: The final exam is on Monday, 5/23, 3:30 pm - 5:30 pm


10.5: Euler and Hamilton Paths (728 - 743)

a) Draw a graph with at least 5 edges and 5 vertices that has neither an Eulerian circuit nor an Eulerian path (4 points)

we need at least three vertices to have odd degree

3 a c3

3
3 f
god
e

b) i) From your answer in a), remove the fewest number of edges to make a graph that has an Eulerian path. (3 points)

To remove we need to make exactly two vertices to have odd


degree

2A c 2

34 go.dz
2

ii) Find an Eulerian path in your answer to b) i) (1 point)

f a b c d e f d

c) Add the least number of edges to your answer for b) i) to make a graph that has an Eulerian circuit. What edges
did you add? (2 points)

2a C2
od a
4 f e
f a b c d e f d f
2
11.4: Spanning Trees (821 - 835)

Excelsior!

Use a BFS (Breadth First Search) to find a spanning tree for graph above. Draw your answer as a rooted tree using
the vertex 0 as the root. (5 points)

O
G
3
4
7
5
5 6
2 s 7

I 4
2
11.5: Minimum Spanning Trees (835 - 840)

Use Kruskal’s algorithm to find a minimum spanning tree. Represent your answer by listing the edges of your
tree in the order encountered. Notation: The edge connecting vertices 0 and 1 can be written as [0,1].
(5 points)

511 5,6 3,7 5,27 0,37 4,6


7,63
10.6: Shortest Path Problems (743 - 753)

Use Djikstra’s Method to find the cheapest path from 0 to 5. I am testing you on your understanding of the
algorithm, not the answer. Make sure you show enough work to convince me of this. (5 points)

Excelsior!

Path length
0,3 6
7 10
0,3
15
0,3 7,5
11
0,3 7,6
0,317,615 14 Shortest

0,3 7,615
11.2: Applications of Trees (793 - 808)

I was doing a Huffman encoding problem and got the following codes:

Letter Code
a 00
b 01
c 10
d 110
e 111

a) Draw the tree. (3 points)


I
0 I
0.5 05
O O 1
a b c
025 O
0.25
d e
0.125
0.125

b) Devise a frequency table that would produce this tree. (7 points)

Letter Frequency
a 0.25
b 0 25
c 0.25
d 0.125
e 0 125
11.3: Tree Traversal (808 - 821)

a) Draw the ordered rooted tree for the expression ((2 + 2) 2) (2 ÷ 2). (2 points)

Excelsior!

2 2 2

2 2

b) Use your answer above to rewrite the expression in prefix notation. (3 points)

2 22122
4: Number Theory (251 - 329)

a) Use Euclid’s Algorithm to show that the greatest common divisor of 752 and 75 is 1. (2 points)

Excelsior!

god 752 75 1
752 10 75 2
75 37.2 I
2 2 1 TO

b) Use your answer from a) to find integers a and b such that 752a + 75b = 1. No credit for finding values for a
and b without showing your work (3 points)

7529 756 1
75.10 2
752
75 1
37 2 from
equal
i 75 371752 75.107 equating
M 75 37.752 75 370 I
371 75 1
M 37 752
75219 75 b
where a 37 b 371
c) Use your answer from b) to solve the congruence 75x 10 mod 752. Your answer should be in the form
x mod 752 where the number in the blank is positive and less than 752 (3 points)

752 I 10 mod 752

371 752 I 371 10 mod 752


12 I 3710 mod 752
So 3710 1752 4 with
remainder
702

D 70 mod752

You might also like