JIGYASA
Would you like to react to this message? Create an account in a few clicks or log in to continue.
JIGYASA

An online placement forum.


You are not connected. Please login or register

Largest BST in a binary tree

Go down  Message [Page 1 of 1]

1Largest BST in a binary tree Empty Largest BST in a binary tree Wed Oct 12, 2011 10:03 pm

codecrker



Given a binary tree return the largest BST ( binary search tree ) present in the binary tree.
/*
The function shall return the root of the largest BST and its size (number of nodes)
*/

NOTE: The largest BST may or may not include all its descendants

---------------------
Variants:

What if the following additional constraint is added to the above problem:
- The largest BST also needs to be a subtree of the given binary tree i.e. it must include all its descendants.

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum