卷別
資料結構與演算法
選擇國立臺灣大學 2026 · 考試 · 第 4 題
考科演算法
(4 points) Which of the following generates a uniformly random permutation of an array of size in place, assuming that returns an integer chosen uniformly at random from ?
RANDOM-PERMUTE(A):
1 for i = 1 to n
2 □
3 if a ≤ b
4 swap A[i] with A[RANDOM(a, b)]
- (A)
- (B)
- (C)
- (D)
- (E)