Average node depth in a randomly built BST.
Analyze the average node depth in a randomly built bst..
Examples
Input: "test_input_1"
Output: "output_1"
Input: "test_input_2"
Output: "output_2"
Hints
Recall that the average depth of a node in a BST is related to the expected height of the tree. What is the expected height of a randomly built BST with n nodes?
Consider the recurrence relation for the average depth. How does it compare to the recurrence for the expected height of a randomly built BST?
Use the fact that the average depth of a node in a randomly built BST is equal to the expected height of the BST divided by 2. Derive the expected height of a randomly built BST using probabilistic analysis.
Average node depth in a randomly built BST.
Analyze the average node depth in a randomly built bst..