← 回題庫

卷別

資料結構與演算法

選擇

國立臺灣大學 2026 · 考試 · 第 13 題

考科演算法

(4 points) Which algorithm guarantees finding the median (the n/2n/2-th order statistic) of an array of nn elements in O(n)O(n) worst-case time?

  • (A)
    Sorting the array and then picking the median.
  • (B)
    Quickselect using random pivots.
  • (C)
    Using a max-heap or min-heap of size nn.
  • (D)
    The median-of-medians selection algorithm.
  • (E)
    None of the other choices.

標準解析

AI 已複查