• Non ci sono risultati.

Algorithm Engineering 29 January 2014 1. [rank 3]

N/A
N/A
Protected

Academic year: 2021

Condividi "Algorithm Engineering 29 January 2014 1. [rank 3]"

Copied!
1
0
0

Testo completo

(1)

Algorithm Engineering

29 January 2014

1. [rank 3] Let us given symbols and probabilities: p(f) = p(e) = 0.07, p(c)=p(d) = 0.15, p(b)=0.2, p(a)=0.36. Construct the Canonical Huffman code, showing how it is obtained step-by-step.

2. [rank 3] Describe the disk striping technique and comment on its (sub)optimality.

3. [rank 3+3] Given the set of strings S={zoo, baa, bac, aba, dab, dbb, bcc, aaa, dab} sort them by multi-key quicksort and by LSD radix sort.

4. [rank 2+3+3] Build a Patricia trie on the set of strings S={aca, acdaba, acdac, bc} and show how it is executed a lexicographic search for the string P1 = aadab, and P2=acb

5. [rank 2+2+3+3]

a. Given a set S of n items in U, define what is a perfect hash function h: U  {0,1, …, m-1}.

b. Given a set S of n items in U, define what is a minimal perfect hash function h: U  {0,1, …, m-1}.

c. Given a set S of n items in U, define what is a minimal ordered perfect hash function h: U  {0,1, …, m-1}.

d. Assume you are given 6 strings (aa, ab, bb, bc, ca, db) and you wish to construct a minimal ordered perfect hash function. Assume that

rank(x)=1,2,3,4 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’’) = rank(x’) * rank(x’’) mod 13 and h2(x’

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

Riferimenti

Documenti correlati

Exercise [rank 6] Prove that the Arithmetic coding algorithm is close to the empirical entropy of a text having length n symbols. Exercise [rank 5] Let us given symbols

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

Exercise [rank 2+2] Provide the motivation of introducing Universal Hashing, with respect to classic hash functions (such as mod, division,…) and an example of family of

[rank 5] Given the string S=aaccacaacc, show the execution of the Skew algorithm for the first level of recursion, thus solving directly the construction of SA^{2,0}, as done

[rank 4] Given the string T[1,9]=ddddaabbcc, compute the Canonical Huffman code for the letters of T assuming as probabilities their empirical frequencies in T.. [rank 5] Given

Prove that the expected reconstruction time of cuckoo hashing is O(n), if it is built over n items and we consider a sequence of a*n insertions, where a is

Then derive the “optimal” size r and comment the resulting time complexity with respect to (1) multi-key quicksort over n strings of length b, or (2) a trie-based sort

[r]