The problem is the following:
Consider the way a drunk would execute MergeSort (we will
call it DrunkMergeSort):
1. Divide the input list of size n into two lists. Because you are drunk, they end
up being of size n/3 and 2n/3 (using ceilings and floors appropriately if n is not
divisible by 3), not n/2 each.
2. Sort the list of size 2n/3 recursively.
3. As you are drunk, you forget to recursively sort the list of size n/3. Everybody
knows the drunks are lucky, so that list just happens to be sorted anyway (thanks,
Bacchus!).
4. Somehow, you manage to apply Merge() on the two sorted lists and produce the
correct result.
---
• What is the asymptotic complexity of the DrunkMergeSort?
• Write the recurrence relation expressing the time complexity of DrunkMergeSort.
2007-04-09
21:55:56
·
1 answers
·
asked by
Anonymous
in
Science & Mathematics
➔ Mathematics