Anda di halaman 1dari 5

12. A W17 has 18 vertices and 34 edges.

T or F


13. Since Prim's and Kruskal's algorithms generate a minimum spanning
tree of a given weighted graph, each algorithm would always
provide identical MST graphs.
T or F

14. A bipartite graph Kn,m has (n*m) vertices and a maximum of
(n+m) edges.
T or F



PART B

Provide your interim solutions to all problems.

Problems that require a particular approach - such as Prim
and Kruskal - need a reasonable amount of intermediate work to
identify and verify the solution process.

1. Form a binary search tree from the words of the following
sentence using alphabetical order and inserting words as they
appear in the sentence:

This exam is easier than the last exam because it is much shorter.


2. The expression below is in postfix expression form. Determine
its numerical value.

{ 2, -3, *, 12, 3, /, 2, -, * }



4. Define a postorder and preorder traversal of the following:
(3 points each)

[(-3 + 5) * 2] / [4 / (2 + x) ] .

a. postorder:
b. preorder:


5. Determine the Minimal Spanning Tree in Graph X using Prims
Algorithm. All edges must be labeled from lower to higher named
vertices, e.g., from "c" to "d" but not from "d" to "c".



6. Given the coding scheme:
a:001, b:0001, e:1, r:0000, s: 0100, t:011, x:01010
Find the words represented by: (1 point each)

a. 0001110000
b. 01110100011
c. 0010000011
d. 001010101
e. What is the best compression ratio (versus ASCII 8-bit encoding)
of the words in a through d above? (2 points). Defend your answer.


7. Determine the Minimum Spanning Tree in Graph Y. Use Kruskal's
Algorithm in which all edges must be labeled from lower to
higher named vertices, e.g., from "c" to "d" but not from "d"
to "c"


8. Construct a postorder, inorder and preorder transversal of
Tree T.(2 points each)
a. postorder:
b. inorder:
c: preorder:



10. Suppose that a full 27-ary tree has 4 internal vertices. How many
leaves does it have? Defend your answer.


11. What is the shortest path in Graph S between "a" and "z". Use
Dijkstra's algorithm.

a. the shortest path is:

b. the shortest distance between "a" and "z" is:


12. A tree has 39 edges. How many vertices does it have?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .














DO ONE of the following:


A. (3 points or no points)
Use a greedy algorithm to determine the shortest path in Graph S.
The algorithm starts at vertex a and ends at vertex z always
selecting the shortest edge. The selection must be in ascending
lexicographic order, i.e., m to n - not n to m. See discussion on
pages 195, 232, and 798.Defend your answer.

B. (1 point or no points)
Is the solution using Prims Algorithm in Question B.7 the same
topology and length as the required Kruskal solution? Defend your
answer.

C. Develop the Basis Step of the algorithm to determine the number of
terms (cardinality) of the union of n mutually intersecting sets.
Show your work.

For example, the cardinality of the union of three mutually
intersecting sets is :

C(3,1) + C(3,2) + C(3,3) = 3+3+1 = 7.


GRAPH INFORMATION



Graph S
Initially draw a hexagon with vertices a-b-d-z-e-c-a.
Connect vertices b to c; b to e; c to z; d to e.
Edge values are:
a-b = 3; a-c = 4;
b-c = 1; b-d = 5; b-e = 5
c-z = 2; c-e = 4;
d-e = 1; d-z = 5; e-z = 3.

b d

a z

c e



Tree T
Construct a Tree with
vertex a at level 0;
vertices b, c and d at level 1;
vertices e, f, i, j, and k at level 2;
vertices g, h, l, m, and n level 3.
Connect vertex a to b, a to c, and a to d.
Connect vertex b to e and f.
Connect vertex c (no further connection).
Connect vertex d to i, j and k.
Connect vertex e (no further connection).
Connect vertex f to g and h.
Connect vertex i to l and m.
Connect vertex j (no further connection).
Connect vertex k to n.
Connect vertex g, h, l m and n (no further connection).


a

b c d

e f i j k

g h l m n


Graph X
Initially draw a rectangle with vertices a-c-e-z-d-b-a.
Connect vertices b to c; c to d; d to e.
Edge values are:
a-b = 1; a-c = 4;
b-d = 3; c-d = 1; c-e = 2;
d-e = 2; d-z = 2; e-z = 2.

a c e


b d z


Graph Y
Draw a hexagon with vertices a-b-d-z-e-c-a.
Connect vertices b to e; c to d; d to e.
Edge values are:
a-b = 3; a-c = 5;
b-d = 2; b-e = 5;
c-d = 3; c-e = 3;
d-e = 1; d-z = 7; e-z = 3.


b d

a z

c e


Graph Z
Graph Z is a five-pointed figure.
Connect a to b, a to c and a to e.
Connect b to d.
Connect c to d.
Connect d to e.

b e

a d


c
Good Luck!

END.
502q4c14b

Anda mungkin juga menyukai