Vous êtes sur la page 1sur 1

Quiz C Name

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).

8. If a directed graph contains tree, backward and cross


edges, it can/cannot be sorted topologically.

9. TRUE or FALSE: The running time of BFS for a graph


A. O(n) represented via adjacency lists is O(V+E).
B. O(log n)
10. What is the running time of the update on the size field
C. O(n ∗ log n) procedure (for a node deletion) in Assignment 6 - Dy-
D. O(n2 ) namic Order Statistics? Briefly motivate.

Vous aimerez peut-être aussi