Machine-translated by Google. Questions are authored in English.
Top

Discussion

Suppose that the splits at every level of quicksort are in the proportion \((1 - \alpha)\) to \(\alpha\), where \(0 \lt \alpha \le \frac{1}{2}\) is a constant. The minimum depth of a leaf in the recursion tree is approximately given by

  • A.\(-\frac{\lg n}{\lg(1 - \alpha)}\)
  • B.\(-\frac{\lg(1 - \alpha)}{\lg n}\)
  • C.\(-\frac{\lg n}{\lg \alpha}\)
  • D.\(-\frac{\lg \alpha}{\lg n}\)

Answer: C

The minimum depth is \(-\lg n / \lg \alpha\).

The shallowest path always follows the smaller part \(\alpha\) of each split. After \(k\) levels the subproblem has size \(\alpha^{k} n\) and the leaf is reached when \(\alpha^{k} n = 1\), giving \[ k = -\frac{\lg n}{\lg \alpha}. \]

The expression with \(\lg(1 - \alpha)\) is the maximum depth, which follows the larger part, and the expressions with \(\lg n\) in the denominator are not depths.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.