資料結構›Ch7 搜尋與排序
第 39 題/共 76 題
◀ DS 39/76
39. Merge Sort、Pseudocode
#DS-07-039中Merge SortPseudocode

(3%) Given the following pseudo code, it sorts the elements of array Y in ascending order and stores the sorted elements to array Z. Y has 2n numbers, n > 0. Let Y[] = {1, 2, 3, …, n, 1, 2, 3, …, n}. The array index is zero based. The pseudo code is as follows.

k = 0, i = 0, j = n
while i < n and j < 2n
  if ( L1 ) {
    L2
    i = i + 1
  } else {
    Z[k] = Y[j]
    j = j + 1
  }
  k = k + 1
end while
while j < 2n
  Z[k] = Y[j]
  k = k + 1, j = j + 1
end while

Which of the following instructions should be placed in (a) and (b), respectively?

📄 交大112
跳轉到第題
▤完整推導請見《WH 資工筆記 · 資料結構》Ch7 搜尋與排序
本章題號 · 21–40 / 76