← 回題庫

卷別

資料結構及演算法

計算

國立政治大學 2025 · 考試 · 第 17 題

Please design an O(log⁡n)O(\log n) algorithm to search for the kk-th element in an AVL tree of nn elements, while the time complexity of insertion operation remains O(log⁡n)O(\log n).

(1) (5%) How to modify the data structure of an AVL tree to support this search operation?

(2) (10%) Give the O(log⁡n)O(\log n) algorithm to search for the k-element.

(3) (5%) How to modify the insertion operation to accommodate for the modification of the data structure.

(Please illustrate your answer by using the AVL-tree provided in Figure 2.)

Figure 2 (AVL tree): root 5454; left child 2323, right child 7979; 2323's children are 1111 (left) and 4545 (right); 7979's children are 6666 (left) and 8888 (right); 4545's left child is 3636.

標準解析

AI 已複查