• Non ci sono risultati.

Algorithm Engineering 20 July 2015 Exercise [rank 4+2]

N/A
N/A
Protected

Academic year: 2021

Condividi "Algorithm Engineering 20 July 2015 Exercise [rank 4+2]"

Copied!
1
0
0

Testo completo

(1)

Algorithm Engineering

20 July 2015

Exercise [rank 4+2] Let us define the operation Drop(k’, k’’) over a Treap consisting of n keys, which deletes from the Treap the keys whose value is in the range [k’,k’’]

(extremes included). Design an algorithm that efficiently implements Drop() and compute its average time complexity (as a function of n).

Exercise [rank 4+4] Let us given two arrays: A[1,n] of items and [1,n] that denotes the permutation of the positions in the range [1,n], such that [i] is the position where the item A[i] must be moved to.

 Describe an I/O-efficient algorithm that permutes the items of A according to permutation , and discuss its I/O-complexity.

 Simulate the proposed algorithm over the arrays A=[c, d, a, b, e] and =[3, 4, 1, 2, 5]

Exercise [rank 3+4]

Let us given a Bloom Filter with k=2 hash functions and n=2^{20} items. Show the calculation that allows to derive the size m such that the error rate of the resulting Bloom Filter is < 1% (note that k is fixed here).

Define what is a Spectral Bloom filter, and show the formula of error rate and prove its correctness.

Exercise [rank 4] Consider the Snow Plow technique.

 Simulate the working of Snow Plow over the sequence S=(1, 3, 9, 6, 2, 10, 4, 8, 5, 7) by assuming that M=2. Generate only the first sorted run.

Exercise [rank 5] Given the graph G formed by the weighted edges E={(b,c,3), (b,e,1), (c,e,4), (c,d,5), (c,a,2), (d,e,1), (d,a,4), (e,a,6)}

 apply the fully external-memory algorithm to compute the MST and turn into the semi-external version (Kruskal) whenever the graph consists of 3 nodes (not applying the initial permuting step on graph’s nodes).

Riferimenti

Documenti correlati

[r]

[r]

This is a contradiction because a positive integer is the sum of two squares if and only if all the prime factors congruent to 3 mod 4 have an even exponent in

[r]

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

Discuss the solution, assuming that the distinct items are m &lt; M, but their total length mL &gt; M (so you cannot explicitly store them in memory), and comment on its

Define the (s,c)-dense code, where assuming s+c=256, specify how many bytes it occupies to represent integer x as a function of s and c, and comment when it can be better

2) Indicate whether it would be preferable to have a larger B or a larger M in order to improve the performance of an algorithm, and comment this answer in the light of point