data structures - AVL tree worst case number of rotations during insertion and deletion -


in avl tree, worst case number of rotations during insertion , deletion of n elements ?

i think insertion should o(n) , deletion should o(nlogn). however, not sure deletion .

am correct?

for both operations - inserting or deleting of node x, there cases require rotations made on nodes x root. since height of tree n nodes o(log n), worst case both operations take o(log n) rotations. n insert/delete operations gives o(n log n).


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -