← 回題庫

卷別

資料結構與演算法(A)

選擇

國立臺灣大學 2022 · 考試 · 第 9 題

考科演算法

(5 points) Consider an array of 8 elements being sorted using quicksort. It has just finished the first pass of partitioning and pivot swapping, thus changing the original array into the following array:

[7,11,16,10,17,1,18,30][7, 11, 16, 10, 17, 1, 18, 30]

How many elements could have been the pivot?

  • (A)
    1
  • (B)
    2
  • (C)
    3
  • (D)
    4
  • (E)
    none of the other choices

標準解析

AI 生成