i only need to determine if at each node the depths of the subtrees rooted at its children are the same or differ at most by 1.
On Jun 26, 12:14 am, sharad kumar <aryansmit3...@gmail.com> wrote: > ok if its not balanced how do u balance it?? > > On Fri, Jun 26, 2009 at 8:16 AM, cgirl <dmitche...@twmi.rr.com> wrote: > > > I am trying to determine if an n-ary tree is balanced or not, I have > > been stuck trying several approaches and am getting nowhere. My new > > thought is that i will have to step through each node of the tree, and > > compare the lengths of the roots of the children, making sure there is > > not a difference greater than one in the values for all of the > > children. Am i thinking in the right direction, or is there a simpler > > solution? > > > thanks, > > kim --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---