求助一道算法题
3. This problem is to analyze the worst-case number of key comparisons for a simple 2-level sorting algorithm described below. Let n = p2 be the number of elements to be sorted.
2.0 Divide the elements into p sets, each of size p.
2.1 Sort the elements within each set using insertion sort.
2.2 Let M[i] be the largest element in the sorted set i. Find the maximum value of all
M[i], 1 ≤ i ≤ p. Output this MAX element, while deleting it from its set.
2.3 Repeat step 2.2 in a similar fashion for finding the second MAX, third MAX, etc.
(a) What is the worst-case number of key comparisons to sort each set of p elements in step 2.1?
Explain.
(b) Give a reasonable upper bound for the worst-case number of key comparisons to find the MAX
in each iteration of step 2.2.
Hint: You can find a reasonable upper bound by observing that each subsequent iteration takes
no more than the first iteration.
(c) Use (a) and (b) to find a reasonable upper bound for the worst-case number of key comparisons
(in terms of n) for the entire algorithm.
我实在不明白key-comparison该怎样去找,等待高人指点!