Académique Documents
Professionnel Documents
Culture Documents
Fundamental Algorithms
May 23th 2017
Time: 7 minutes Points
1. The average running time of insertion sort is O(?) 5. h(k, i) = (h0 (k) + c1 ∗ i + c2 ∗ i2 )%m is the hash function
used in quadratic probing. What does i represent?
2. As part of the maintenance work, you are entrusted
with the work of rearranging the library books in a shelf 6. What kind of tree do you need to build in order to per-
in proper order, at the end of each day. The ideal choice form repeated searches by rank efficiently (assignment
will be: 6)? (enumerate all attributes of the tree – type, struc-
A. bubble sort ture, additional fields etc).
B. insertion sort 7. Being given the pseudocode for F IN D − SET
C. selection sort F IN D − SET (x)
D. merge sort 1 if x! = x.p
2 x.p = F IN D − SET (x.p)
3. TRUE or FALSE: A heap is a particular kind of a bi- 3 return x.p
nary search tree. Modify it to remove path compression (i.e. it will still
4. The curve below corresponds to a growth of: return the representative, but it will not modify the
tree).