CS507 Data Structures and Analysis of Algorithms
Final Exam - given on April 28, 1998
-
Give an implementation of a three-way merge sort algorithm, that is an algorithm which splits the input array into three equal (~) parts, sorts each of them and then merges the three sorted subarrays into the original array.
-
Assume that A is a sorted array of integers, of size n. Implement a variation of binary search which would recursively split the array at the index n/4, rather than at n/2.
What would the be the worst case behavior of your algorithm?
-
Assume that a hash table with open address hashing would use a probing function defined by
p(k,i)=(h(k)+2i) mod TABLE_SIZE.
Under what conditions would hashing work correctly?
What would the incorrect behavior mean in this case? Give an example (e.g. a concrete hash table and a sequence of insertions).