0% found this document useful (0 votes)
86 views

Second Semester Examinations 2017/2018: Answer FOUR Questions

This document is a past exam paper for the course COMP526 Applied Algorithmics from the Computer Science department. It contains 5 questions testing knowledge of algorithms and data structures. Students are instructed to answer 4 of the 5 questions, which include topics like error detection, Huffman coding, suffix trees, sorting algorithms, and the Burrows-Wheeler Transform. The exam is 2.5 hours long and tests both theoretical understanding and practical problem solving skills related to algorithms.

Uploaded by

hussein hammoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

Second Semester Examinations 2017/2018: Answer FOUR Questions

This document is a past exam paper for the course COMP526 Applied Algorithmics from the Computer Science department. It contains 5 questions testing knowledge of algorithms and data structures. Students are instructed to answer 4 of the 5 questions, which include topics like error detection, Huffman coding, suffix trees, sorting algorithms, and the Burrows-Wheeler Transform. The exam is 2.5 hours long and tests both theoretical understanding and practical problem solving skills related to algorithms.

Uploaded by

hussein hammoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PAPER CODE NO. EXAMINER : Leszek A.

Gasieniec
˛ Tel. No. 7954290
COMP526 DEPARTMENT : Computer Science

SECOND SEMESTER EXAMINATIONS 2017/2018

Applied Algorithmics

TIME ALLOWED : Two and a Half Hours

INSTRUCTIONS TO CANDIDATES

Answer FOUR questions.


If you attempt to answer more questions than the required number of questions (in any section),
the marks awarded for the excess questions answered will be discarded (starting with your
lowest mark).

PAPER CODE COMP526 page 1 of 6 Continued


Question 1

1.A Consider a sequence of bits D = D3 D2 D1 D0 = 0110 that is to be sent


across a noisy communication channel.
• Explain why the error detection mechanism requires 3 parity bits in this
case (3 marks).
• Compute the three parity bits P2 , P1 and P0 and interleave them with the
bits of the sequence D accordingly (5 marks).
• Summarise briefly the mechanism utilised during discovery of single bit
flips (3 marks) and explain why this mechanism works (4 marks).
[Total: 15 marks]

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.

1. Determine the contents of words w1 , w2 and s1 , s2 (1 mark) and compute


the leftmost witnesses against all non-periods in w2 and s2 (2 marks).
2. Show that wi is the reverse of si , for all i ≥ 0, where a word a[0 . . . n − 1]
is the reverse of b[0 . . . n − 1] if a[j] = b[n − j − 1], for all j = 0, . . . , n − 1.
(4 marks)

[Total: 7 marks]

1.C Write a short note on the main differences between formal and experimental
analysis of algorithms.
[Total: 3 marks]

PAPER CODE COMP526 page 2 of 6 Continued


Question 2

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]

2.B Let O = (6, 3, 3, 6, 6, 0, 5, 6, 7, 0, 2, 3, 5, 6) and Q = [E, C, A, S, I, N, O, R]


be respectively the output sequence of indexes and the content of the queue
of symbols after application of MTF (Move-to-Front) algorithm on the input
sequence S. Recover the content of S (3 marks) and trace the content of Q
throughout execution of inverse MTF (Move-to-Front) algorithm (4 marks).

[Total: 7 marks]

2.C Provide the definition of ε-tester and discuss in brief its application.

[Total: 3 marks]

PAPER CODE COMP526 page 3 of 6 Continued


Question 3

3.A Consider the problem of checking whether a 0-1 sequence S[0, . . . , n − 1]


of length n contains k consecutive zeros, for some integer k ≥ 1.
• Write a pseudocode or explain in plain language a sequential solution to this
problem (6 marks) and comment briefly on its correctness and complexity
(2 marks).
• Discuss briefly one round of a parallel solution (5 marks) and comment on
the parallel solution complexity (2 marks).
[Total: 15 marks]

3.B A stream starting with symbols BACABACBCACBACB . . . forms the


input to Misra-Gries algorithm for computing two very frequent items. Explain
the principles of Misra-Gries algorithm (3 marks) and determine the contents of
the two counters after scanning prefixes BACABACBC (2 marks) as well as
BACABACBCACB (2 marks) from the input stream.

[Total: 7 marks]

3.C What is the main mechanism utilised in Lempel-Ziv-Welch text compression


algorithm? [Total: 3 marks]

PAPER CODE COMP526 page 4 of 6 Continued


Question 4

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]

PAPER CODE COMP526 page 5 of 6 Continued


Question 5

5.A Explain briefly the mechanism used in the Burrows-Wheeler Transform


(BWT) procedure (3 marks). Consider an infinite language in which the kth
word wk = bk (ab)k a, for all integers k ≥ 0. Compute first w0 , w1 , w2 and w3
(2 marks) and generate BW T (w3 ) (4 marks). Explain also what is the structure
of BW T (wk ) for k ≥ 2 (6 marks).
[Total: 15 marks]

5.B Consider an instance of the Combinatorial Group Testing Problem, in which


a collection of 10 items C = I1 , I2 , . . . , I10 is tested for having a property P.
The results of 7 tests performed on subsets of items in C are represented as the
feedback vector in Figure 1. Explain which items from the collection C have
the property P (4 marks) and identify the smallest number of tests (among 7
proposed) allowing to draw the same conclusion (3 marks) .

T EST # / I TEMS : I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 F EEDBACK VECTOR

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

Figure 1: The round of 7 tests and the feedback vector.

[Total: 7 marks]

5.C Comment briefly on the main principles and properties of quick-sort.


[Total: 3 marks]

PAPER CODE COMP526 page 6 of 6 End

You might also like