Binary Search & Balanced Trees

Answer & solution
Official answer: C
Worked explanation
With m nodes, an AVL tree has height Θ(log m); locating an insertion position and propagating height changes take O(log m), while rotations do not introduce a larger order. During the sequence, m=n+i for 0≤i<n². Thus the total upper bound is Σ O(log(n+i))≤n² O(log(n+n²))=O(n² log n). For ordinary comparison-based insertion of distinct keys, an AVL tree’s external search paths have logarithmic depth; in particular an adversarial sequence can repeatedly force logarithmic work. A constant fraction of n² operations therefore contributes Ω(n² log n). Do not multiply by an extra n for rebalancing.
Derivation and answer
Throughout the n² insertions the AVL size lies between n and n+n², so each logarithmic insertion is O(log n). Their total is O(n²log n), and worst-case searches over a constant fraction of the later insertions require Ω(log n) each. Hence Θ(n²log n), C.