Question 12.1.8: Assume that we want to find the k-th element of a set (accor......

Assume that we want to find the k-th element of a set (according to the ordering on T) in time limited by C . (tree height). What additional information do we need to store at the tree vertices?

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

At each vertex, we store the number of its descendants. When a vertex is added or deleted, this information must be updated along a path from the root to the new/deleted vertex. While searching for the k-th vertex, we maintain the following invariant: the vertex in question is the s-th vertex (according to the T-ordering) of a subtree rooted at x (here s and x are variables).

Related Answered Questions

Question: 12.2.2

Verified Answer:

By induction over n, we prove that Φ_{n+2} ...
Question: 12.2.1

Verified Answer:

The maximal number of vertices is equal to ...
Question: 12.1.3

Verified Answer:

val [null]  := t; x := root ; while t <> val...
Question: 12.1.2

Verified Answer:

if root = null then begin ..t is not in the tree e...