390 views
2 votes
2 votes

Let $T$ be an AVL tree for storing a set of $n$ integers. Insertions and deletions in $T$ can hence be done in $O(\log n)$ time. Given two integers $a$ and $b, \: a < b$, you have to output nab, the number of integers in T whose value lies within $[a, b]$ in $O(\log  n)$ time.

  1. For this purpose, what modification of $T$ and its insertion algorithm are required?
  2. Give a pseudo-code for computing $n_{ab}$.

Please log in or register to answer this question.

Related questions