How many different binary trees and binary search trees can
be made from three nodes that contain the key values 1, 2 & 3?

Answer Posted / sreekumar

Nubmerof Nodes| BT Possible | BST Possible|
==============+================+==============
1 | 1 | 1
--------------+----------------+---------------
2 | 2 | 2
--------------+----------------+---------------
3 | 6 | 5
--------------+----------------+---------------
4 | 24 | 14
--------------+----------------+--------------
. | . | .
--------------+----------------+--------------
| |
| | 2n 1
| | C * ------
n | n! | n (n+1)
------------------------------------------------------

C=Combinations
n!,2nCn /(n+1)

Is This Answer Correct ?    57 Yes 35 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which sorting is stable?

470


Is vector a collection?

450


Is it necessary to sort a file before searching a particular item ?

545


What is stack explain with diagram?

503


What is the difference between arrays sort and collections sort?

429






What is hash data type?

522


Is array size dynamic or fixed?

492


What is meant by strongly connected in a graph?

505


List some applications of queue data structure.

512


What is the use of data structure in real life?

489


What is map entry?

484


What does bubble sort do?

446


How many types of data structure are there?

446


What happens if we put duplicate key in hashmap?

485


What method is used to place a value onto the top of a stack?

559