Maximum Sized Binary Search Tree in a Binary Tree:
http://www.rawkam.com/?p=822
On Mon, Sep 27, 2010 at 10:34 AM, Chonku cho...@gmail.com wrote:
@Prodigy
As per your example, 8 15 20 25 which is the is indeed the maximum binary
search tree in this binary tree is only a solution to smaller
For solution to this problem see
http://groups.google.co.in/group/algogeeks/browse_thread/thread/adc95dcf96020a7/2943fd3c5a116fee?hl=enlnk=gstq=binary+tree+to+binary+serach+tree#
In that thread, I have a doubt regarding solution posted by @Algoose
Chase. The code posted is good as I feel except
@Prodigy
As per your example, 8 15 20 25 which is the is indeed the maximum binary
search tree in this binary tree is only a solution to smaller problem used
to solve a bigger problem.
The solution to smaller problem can be translated directly to the solution
of the bigger problem.
On Mon, Sep
BSTP : Root's right and left subtrees are BST and value at Root is
(greater than largest of left) and (smaller than lowest of right).
if BSTP is true, size of this BST is sum of (size of left subtree) and
(size of right subtree) plus 1. Compare this value with global
maximum.
Do it recursively.
This can also be done if we do an inorder traversal of the binary tree and
look for the longest continuous sequence of numbers in ascending order.
On Sun, Sep 26, 2010 at 11:10 AM, mac adobe macatad...@gmail.com wrote:
No parody .. that would be another doubt :(
On Sat, Sep 25, 2010 at
15
/\
8 25
/\
20 22
On Sep 26, 10:45 am, Chonku cho...@gmail.com wrote:
This can also be done if we do an inorder traversal of the binary tree and
look for the longest continuous
No parody .. that would be another doubt :(
On Sat, Sep 25, 2010 at 11:03 PM, prodigy 1abhishekshu...@gmail.com wrote:
By maintaining a current maximum and a global maximum. You do know how
to verify a BT is BST .
http://pastebin.com/xwXXTEnP
On Sep 25, 9:04 pm, mac adobe
@parody :..and how would that find me a maximum size BST .. ??
( for checking if this BT is BST i would do inorder traversal and see if it
is increasing )
On Sun, Sep 26, 2010 at 11:10 AM, mac adobe macatad...@gmail.com wrote:
No parody .. that would be another doubt :(
On Sat, Sep