問題詳情

11.
【題組】

(31) Consider the following algorithm. Algorithm Sort(A, n)
Input: Array A containing n different integer values.
Out: Array A sorted in increasing order of values.


Which of the following instructions must be inserted at the point marked (*) so that the algorithm correctly sorts the values stored in A in increasing order of values?
(A) for j ← 0 to n - 1 doif A[j] > A[m] then m ← j
(B) for j ← i+1 to n - 1 doif A[j] > A[m] then m ← j
(C) for j ← 0 to i - 1 doif A[j] > A[m] then m ← j
(D) for j← i+ 1 to n -1 doif A[j] < A[m] then m ← j
(E) for j ← O to n -1 doif A[j] < A[m] then m ← j

參考答案

答案:[無官方正解]
難度:計算中-1
書單:沒有書單,新增