954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Prove that every subtree of a binary search tree is a binary search tree.

- Prove that every subtree of a binary search tree is a binary search tree.

ifiok.idiang
Newbie Poster
4 posts since Feb 2011
Reputation Points: 8
Solved Threads: 0
 

Been there, done that. What's your answer?

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Nope. Show some effort if you expect help with your homework.

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

A hint, read the definition of a binary tree, then see how it applies to the trees's children.

firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
 

Proof Let T be a binary search tree, and let S be a subtree of T. Let x
be any element oin S and let TL and TR be the left and right subtrees,
respectively, of x in S. Then since S is a subtree of T, x is also an element
of T, and TL and TR are left and right subtrees of x in T. Therefore,
y x z for every y 2 TL and every z 2 TR. Therefore, S too has the
Binary Search Tree (BST) property.
6

ifiok.idiang
Newbie Poster
4 posts since Feb 2011
Reputation Points: 8
Solved Threads: 0
 

That sounds correct (assuming you've defined a BST accordingly).

If you want to be really anal you should explicitly point out that S is a binary tree.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You