• Non ci sono risultati.

Algorithm Engineering 15 February 2019 Name: Surname: Matricola:

N/A
N/A
Protected

Academic year: 2021

Condividi "Algorithm Engineering 15 February 2019 Name: Surname: Matricola:"

Copied!
1
0
0

Testo completo

(1)

Algorithm Engineering 15 February 2019

Name: Surname: Matricola:

Exercise [rank 5+5+3+5]

Describe the pseudocode of bounded quicksort and its properties.

Describe the algorithm, based on exponential jumps, to solve the intersection problem between two sets of n and m items each,

State and prove the time complexity in the worst case of the algorithm above.

Describe the (s,c)-code for a coderword of length b bits.

Exercise [rank 5] Given the string S=abaa, compute its Arithmetic encoding based on empirical frequencies by emitting the final binary compressed string. (hint: please work with dyadic fractions, and assign “a” to the bottommost range of (0,1).)

Exercise [rank 5+2] Assume you are given 7 strings S = (aa, ac, ba, bb, bc, cc, dd) and you wish to construct a minimal ordered perfect hash function (MOPHF).

Assume that rank(x)=1,2,3,4,5 for the characters x=a,b,c,d, respectively. Given a string x’x’’ of two characters, we let the two random functions required by the design of MOPHF as h1(x’ x’’) = 5 * rank(x’) * rank(x’’) mod 11 and h2(x’

x’’) = 2 * rank(x’) + rank(x’’) mod 11 (so m=11). Design a proper g(t) to construct the final h(t) for S, if this is possible given h1 and h2 above.

Can the MOPHF compute the rank of a string not in the set S ? Motivate the answer, possibly by providing a counter-example.

Exercise [LODE] Assume that you are given a sequence S of K files of arbitrary individual length and total length N. You wish to efficiently count the number of distinct files in S, without comparing them explicitly in pairs because they can be very long. Design a randomized algorithm that uses an external-memory sorter as a black-box, and comment on its I/O complexity and probability of a successful

estimate of the count.

Riferimenti

Documenti correlati

Ex 2 [ranks 3] Given the string S=aaba, compute the length of its Arithmetic encoding without running the entire algorithm, and comment

Exercise [rank 5] Given the string S=baobab, compute the Suffix Array, and then derive the LCP array by using the linear-time algorithm seen in class, showing the amount of

Simulate the behavior of the algorithm MultiKey-Quicksort on the following array of 6 strings S=[zoo, horse, bath, abacus, bar, aargh].. Exercise

[r]

Finally simulate its working over the sequence 3,10,1,6,2,5,3, by showing the sorted blocks it forms with a memory capable to store M=2 integers.. Exercise

Write the pseudo-code of the Reservoir Sampling algorithm that random samples m items from a sequence of unknown length. Prove that the probability of extracting any element when

 discuss the efficiency of PRIM’s algorithm when the graph grows in

Exercise [rank 5] Discuss the optimality of the disk striping technique in combination with multi-way mergesort when sorting N items over D disks, in a model with.. internal memory