Second Semester Examinations 2017/2018: Answer FOUR Questions
Second Semester Examinations 2017/2018: Answer FOUR Questions
Gasieniec
˛ Tel. No. 7954290
COMP526 DEPARTMENT : Computer Science
Applied Algorithmics
INSTRUCTIONS TO CANDIDATES
1.B Two infinite languages W = {w0 , w1 , w2 , ...} and S = {s0 , s1 , s2 , ...} are
defined over the same binary alphabet A = {a, b}, and related to one another.
Where w0 = s0 = a, as well as wi = wi−1 · si−1 · b and si = b · wi−1 · si−1 , for
all integer i ≥ 1.
[Total: 7 marks]
1.C Write a short note on the main differences between formal and experimental
analysis of algorithms.
[Total: 3 marks]
2.A Let alphabet A = {A, B, C, D, E}, where symbols in A have the following
representation A = 01, B = 000, C = 11, D = 001, and E = 10 in the relevant
Huffman code H.
• Propose probabilities P (A), P (B), P (C), P (D) and P (E) for the symbols
in A which are consistent with the Huffman code construction (3 marks),
and explain why this choice is correct (4 marks).
• Explain also why code H0 in which A = 01, B = 000, C = 11, D = 101,
and E = 10 is not a Huffman code (3 marks).
• Finally, comment briefly on the time complexity of the Huffman code con-
struction (2 marks) and compute the bit rate of code H with your choice of
probabilities (3 marks).
[Total: 15 marks]
[Total: 7 marks]
2.C Provide the definition of ε-tester and discuss in brief its application.
[Total: 3 marks]
[Total: 7 marks]
4.A Draw a suffix tree (5 marks) and its compact counterpart (4 marks) for the
input string baababba and create the respective suffix array (4 marks) for the
same input string. Comment briefly on sizes of compact suffix trees and suffix
arrays for strings built over constant size alphabets (2 marks).
[Total: 15 marks]
4.B Explain the main differences between sequential merge-sort and heap-sort
procedures (4 marks). Comment briefly on the time complexity of both proce-
dures (3 marks).
[Total: 7 marks]
4.C Explain what are the basic operations defined on queues and what is their
time complexity.
[Total: 3 marks]
T1 0 0 0 1 0 1 1 0 0 0 0
T2 1 0 0 1 1 0 0 1 0 1 1
T3 1 0 0 1 0 1 0 1 0 0 0
T4 0 0 1 0 0 1 0 0 0 1 0
T5 0 0 0 1 0 0 0 0 0 1 0
T6 0 1 0 0 1 0 1 0 1 0 1
T7 0 1 1 0 0 0 1 0 1 1 0
[Total: 7 marks]