Re: [algogeeks] Fixing Up The Binary Search Tree

2012-06-29 Thread Karthikeyan V.B
calculate the balance factor for all nodes and find any node with factor 
1 or factor  -1 and perform AVL rotation from that node

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Fixing Up The Binary Search Tree

2012-06-28 Thread atul anand
we can go for bottom up approch .so go the leftmost leaf node and then
pass this node as a root to the function which implements AVL rotations.Do
the same as we move back in the recursion  i guess this will work as we
are balancing the the left and right subtree of node say X before we move
back.

On Wed, Jun 27, 2012 at 10:32 PM, Krishna Kishore
kknarenkris...@gmail.comwrote:

 Suppose a Binary Search Tree which is unbalanced.is given. Write a
 routine to balance the Binary Search Tree.
 Send the Root of the BST as an argument to that routine. It has to Return
 the Root of the Balanced BST.
 Thanks In Advance.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/iYdbt5mI4BQJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Fixing Up The Binary Search Tree

2012-06-27 Thread Krishna Kishore
Suppose a Binary Search Tree which is unbalanced.is given. Write a routine 
to balance the Binary Search Tree.
Send the Root of the BST as an argument to that routine. It has to Return 
the Root of the Balanced BST.
Thanks In Advance.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/iYdbt5mI4BQJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.