Question

Assume that a BST was built purely with insertions and all key orderings are equally likely. You are given the root of a particular tree, what is the probability that the given tree was built?

No correct solution

OTHER TIPS

The answer to this question can be calculated recursively.

prob. of tree = prob. of root being chosen correctly * prob. of left subtree being formed * prob. of right subtree

we now only need to find the prob. of root being chosen correctly, which is 1/num. of nodes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top