-->
当前位置:首页 > 题库

单选题:A $n$-nodes AVL tree $T$ performs insertion or deletion in the w

Luz4年前 (2022-06-30)题库674
A $n$-nodes AVL tree $T$ performs insertion or deletion in the worst case that costs $a_0 \lg n + b_0$, $a_1 \lg n + b_1$, respectively, where $a_0, a_1, b_0, b_1$ are constants. Now, we start from an empty tree, perform a sequence of $n$ insertions or deletions in the AVL tree. To analysis the amortized cost per insertion or deletion, we define a potential function $\Phi(T) = a_1 \sum_{i=1}^{n} \lg i$. What is the amortized cost per insertion or deletion?






A.$O(\lg n )$ for insertion $O(\lg n)$ for deletion
B.$O(\lg n )$ for insertion $O(1)$ for deletion
C.$O(1)$ for insertion, $O(\lg n)$ for deletion
D.$O(1)$ for insertion, $O(1)$ for deletion


答案:B