• Non ci sono risultati.

Algorithm Engineering 7

N/A
N/A
Protected

Academic year: 2021

Condividi "Algorithm Engineering 7"

Copied!
1
0
0

Testo completo

(1)

Algorithm Engineering

7 February 2020

Name: Surname: Matricola:

Exercise [rank 3+3+3] Assume that you are given a sequence S of n pairs <string, occ>, in which possibly more than one pair can refer to the same string and occ is an integer denoting a satellite value. Say s is the number of distinct strings in S.

<baco,2><ala,1><bar,5><baco,6><zoo,1><ala,8><baco,3>….

Design an I/O-efficient algorithm that computes the string with the maximum sum of satellite values by discussing and evaluating its I/O-complexity (where M is the size of the internal memory, and B is the disk page size) in the following three cases:

M is very small, much less than the number s of distinct strings;

M can fit O(s log n) bits and we admit errors (in probability) in the answer;

M can fit O(s) pointers to strings and O(s) characters and counters (hint: think to a trie-based solution, but not a classic trie…);

Exercise [rank 5+3] Given the sequence of integers S = 1 2 3 4 6 10 11,

compress the entire S via Interpolative Coding

compress the gaps between the consecutive integers of S by PForDelta using b=2 bits, and base = 1.

Exercise [rank 5] 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.

Exercise [rank 3+5] Answer to the following questions:

a. State and prove the bound for sorting N items in an external-memory model whose disk-page size is B and memory-size is M over D disks via disk striping; and compare it with the optimal bound.

b. Show that the average depth of Treaps is logarithmic in the number of keys, whenever priorities are chosen uniformly at random.

Riferimenti

Documenti correlati

Before acquiring a well-defined position in society, subjects pass through a period and area of ambiguity − a sort of social limbo which has the features neither of the preceding,

As a result, an elementary function characterizing different technologies (e.g. mixing, drying, sifting etc.) is evaluated through the same performance EPs, but possibly

The resulting binary images are input into the spline-based algorithm for diameter estimates and the measurements performance against REVIEW is reported in Table 8.. The removal

[r]

The result is the logistic regression model // based on the best set of parameters (based on the results of the // cross-validation operation). CrossValidatorModel model

• Scan the sorted list to find a match with the second half of the

•  Beta compute a hash of the file B and send it to alpha?. •  Alpha compute the hash of A and send back to beta either the hash (if the two hash are the same) or the content of

For example, Margaret Kaseje and Verha Okeyo, in their chapter on health communication in selected African countries, highlight an interesting difference between the global South