Chapter 8: Q22SE (page 567)
Find a recurrence relation that describes the number of comparisons used by the following algorithm: Find the largest and second largest elements of a sequence of n numbers recursively by splitting the sequence into two subsequences with an equal number of terms, or where there is one more term in one subsequence than in the other, at each stage. Stop when subsequences with two terms are reached.
Short Answer
The recurrence relation is
\(\begin{array}{l}f(n) = f(n/2) + f(n/2) + 2\\ = 2f(n/2) + 2\:\\{\rm{when}}\:n = {2^k}\end{array}\)