707 views
4 votes
4 votes
When searching for the key value 30 in a binary search tree, nodes containing the key values 10, 20, 25, 35, 70, 80, 90, 100 are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root node containing the value 30?

-----------------------------------------------------------------------------------------------------------------------------------------

Solution is

1)  8!/(3!*5!) (here tree permutation is done based on non root node of the tree as a whole)

or

2)  it could be

3*2*5*4*3*2 (here division is based on left subtree and right subtree

where 3*2 is permutation for left subtree and 5*4*3*2 is permutation of right subtree)

---------------------------------------------------------------------------------------------------------------------------

what is difference between solution 1) and solution 2)?

why in both case answer is different?

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2