• Non ci sono risultati.

Algorithm Engineering29 June 2017Name:Surname:Matricola:

N/A
N/A
Protected

Academic year: 2021

Condividi "Algorithm Engineering29 June 2017Name:Surname:Matricola:"

Copied!
1
0
0

Testo completo

(1)

Algorithm Engineering 29 June 2017

Name: Surname: Matricola:

Exercise [rank 3+3] Perform the intersection between the two sets S1 = {1, 8, 10} and S2 = {1, 2, 5, 7, 10, 15, 20} via

 the “mutual partition” algorithm

 the algorithm based on “binary search with exponential jumps”

Exercise [rank 3+3+3] Given the undirected and weighted graph G={(A,B, 2), (A,F, 1), (A,E, 6), (B,C, 6), (B,F, 3), (C,D, 3), (C,F, 5)}.

 Compute the MST via the Kruskal’s algorithm

 Compute the MST via the Prim’s algorithm

 Compute the MST via the external-memory algorithm of Sybein Show the steps of each algorithm and the content of the used data structures.

Exercise [rank 6] Given the integer sequence S = (1, 3, 4, 6, 8, 9, 10), show how Interpolative Coding compresses the “first three” integers according to its algorithm.

Exercise [rank 3+3+3]

 Prove how an LCA query over an arbitrary tree can be turned into an RMQ query over an integer array.

Describe the RMQ data structure that occupies space O(n log n) bits and answers queries O(1) time.

Show your transformation on the tree rooted in 1 and defined by the following edges {(1,2), (1,3), (1,4), (2,5), (2,6), (4,7)}, and indicate how it is answered a query on the two leaves 5 and 7.

Exercise [lode – wait first round of correction] Show and prove the two properties that allow the LCP-algorithm to run in time linear in the string length. Comment on how they are used in that algorithm to compute the LCP-array.

Riferimenti

Documenti correlati

Compress the text “AC” via Arithmetic coding, using ratios to make computations, and emitting the final sequence of bits.. You are given the graph below, in which the bold

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

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

 Show the pseudo-code of the variant of binary quicksort that reduces the extra- space used during recursive calls, and comments on its complexity

Exercise [lode] Describe when the “strange case” of LZW occurs and how it is solved by the decompression algorithm, by providing also a

Write the pseudo-code of the algorithm that random samples m items from a sequence of known length n by means of a scanning approach. 2) design an algorithm that solves, via

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

[rank 5] Describe the Snow Plow algorithm, comment in which sorting algorithm can be used and how it is used, and simulate its working over the sequence 3,8,1,5,1,4,2, and show