- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
We consider an $\text{ AVL }$ tree $T$. At each node $v$ of the tree the number of nodes of the left subtree of $v$ is stored.
I want to write an algorithm that returns the $j^{th}$ smallest element of the tree in time $O(\log m)$ where $m$ is the number of nodes of the tree.
How could we do this? Could you give me a hint? (Thinking)
We consider an $\text{ AVL }$ tree $T$. At each node $v$ of the tree the number of nodes of the left subtree of $v$ is stored.
I want to write an algorithm that returns the $j^{th}$ smallest element of the tree in time $O(\log m)$ where $m$ is the number of nodes of the tree.
How could we do this? Could you give me a hint? (Thinking)