Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

I need a way to change the Binary tree to Binary Search tree without using extra space. Could anyone suggest the algorithm

OpenStudy (anonymous):

A binary search tree is a type of binary tree. In a binary search tree, a left child must always have a value less than its parent. A right child must always have a value greater than its parent. Do you need the method to create a binary search tree?

OpenStudy (anonymous):

yes

OpenStudy (rsmith6559):

if( value == nodeValue ) panic(); else if( value < nodeValue) { if( leftPointer ) goLeft; else makeNewNode( rightPointer ); } else { if( rightPointer ) goRight; else makeNewNode( rightPointer ); } The real fun of binary trees is keeping them (relatively) balanced.

OpenStudy (anonymous):

I know all these, But the thing is what I need is, given a Binary tree , should convert the same to Binary Search Tree

OpenStudy (rsmith6559):

Easiest way, and only costs a pointer, would be to traverse the BT, and move the nodes into the BST.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!