卷別
資料結構與演算法
選擇國立臺灣大學 2026 · 考試 · 第 23 題
考科資料結構
(4 points) Consider the linked-list representation of disjoint sets, where: (1) each set is represented by a linked list; (2) each element stores a pointer to the set's representative; (3) appends the shorter list to the longer list (union by weight/size); (4) runs in since the representative pointer. Which of the following statements is correct?
- (A)The total time for all operations is , regardless of how unions are ordered.
- (B)The total running time of all operations is , because dominates.
- (C)Using union by size makes amortized , yielding total time .
- (D)The total time of all operations is , because each operation touches at most a constant number of elements.
- (E)Each element's representative pointer can be updated at most times, so all operations take time.