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

Is Arraylist faster than Array? Why?

529


Is it legal to initialize list like this?

545


Define balancing condition for AVL Tree.

544


How do you make a bubble chart with 3 variables?

467


Which is better merge or quick sort?

550






What is the difference between a Stack and a Queue.

496


Differentiate between hashmap and treemap.

499


What are the advantages and disadvantages of copyonwritearraylist?

624


What is arraylist load factor?

512


write a program to show the insertion and deletion of an element in an array using the position

496


What is 1d array?

462


Define graph traversals?

530


What is difference between stack and queue?

488


Can a stack be described as a pointer? Explain.

448


Explain the Queue

574