When to use iterative development? You should use iterative development only on projects that you want to succeed. Martin Fowler

Binary Tree to BST Conversion

Language Java | Level Intermediate | Category Data structure | September 8, 2015 7:54 am


Data structure Description

Write a program to convert Binary Tree to Binary Search Tree. The binary search tree left side node values are less than or equal to parent node and right side node values are greater than or equal to the parent node.


Output

   					 

All Binary Tree Values: 20  30  10  15  5  
Convert from Tree to Array:[20, 30, 10, 15, 5]
After sort the array: [5, 10, 15, 20, 30]
After convert from Binary Tree to Binary Search Tree Values: 5 10  15  20  30  

				    

Comments


No comments available!

Please login to add comments.