Professional Documents
Culture Documents
NAME: __________________________________________________________________________
RUID:___________________________________________________________________________
Electronic Devices are not permitted during the quiz. These include but are not restricted to calculators,
computers and cell phones.
No communication between students or anyone outside of class is permitted during the quiz.
Textbooks, notes and any other written materials are not permitted during the quiz.
1. For each of the following trees, write True if it is a binary search tree where items are maintained
in alphabetical order. Otherwise, write False.
_____________ a)
_____________ b)
_____________ c)
_____________ d)
2. For each of the following codes, write True if it is a prefix code. Otherwise, write False.
________________ a)
________________ b)
________________ c)
________________ d)
3. For each of the following codes, compute the average number of bits to encode a single character if
the character frequencies are as shown. Additionally, specify whether or not the code is a Huffman
code (write True if it is a Huffman Coding, otherwise write False).
a)
code:
frequencies:
a:
0,
a: 0.6,
b:
b: 0.4
b)
code:
a: 100,
b: 101,
c: 110,
d: 111
frequencies:
a: 0.2,
b: 0.3,
c: 0.2,
d: 0.3
c)
code:
frequencies:
a: 00110,
b:
10,
c: 110
a:
b: 0.4,
c: 0.5
0.1,
For each of the blanks below, select the correct visitation order of vertices for the specified type of
traversal.
A) a, b, c, d, e, f, g, h, i, j, k, l
B) l, k, j, i, h, g, f, e, d, c, b, a
C) f, b, j, d, a, g, k, c, h, e, l, i
D) l, i, e, k, h, c, g, j, d, a, f, b
E) a, b, c, d, f, g, j, k, e, h, i, l
F) l, i, e, h, c, d, g, k, j, f, a, b
G) b, a, f, d, j, g, k, c, h, e, l, i
H) i, l, e, h, c, k, g, j, d, f, a, b
I) b, f, j, k, g, d, h, l, i, e, c, a
J) a, c, e, i, b, d, h, l, g, k, f, j
K) a, c, e, i, l, h, d, g, k, j, f, b
L) j, k, l, f, g, h, i, d, e, b, c, a
M) l, i, h, e, k, j, g, f, d, c, b, a
N) a, c, b, e, d, i, h, g, f, l, k, j
O) b, a, c, d, e, f, g, j, k, h, l, i
P) i, e, c, a, l, h, d, b, k, g, j, f
5. Compute the value of each of the following expressions assuming each is in prefix, infix or postfix
notation as indicated. (As in the book, indicates exponentiation.) If the value cannot be
computed due to lack of operators or lack of operands, write Impossible.
_____________ a) Prefix: + - 3 2 2 3 / 6 4 2
_____________ b) Prefix: * + 3 + 3 3 + 3 3 3
_____________ e) Postfix: 5 2 1 - - 3 1 4 + + *
_____________ f) Postfix: 3 2 * 2 5 3 8 4 / * -
Scratch Paper