Trying to determing if n-ary tree is balanced.

Discussion in 'C++' started by cgirl, Jun 26, 2009.

  1. cgirl

    cgirl Guest

    I am trying to determing if a 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
    cgirl, Jun 26, 2009
    #1
    1. Advertising

  2. cgirl

    red floyd Guest

    cgirl wrote:
    > I am trying to determing if a 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?


    Did you have a C++ question? Try comp.algorithms
    red floyd, Jun 26, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wynan James

    Depth of n-ary tree

    Wynan James, Sep 29, 2003, in forum: Java
    Replies:
    10
    Views:
    11,169
    Stefan Poehn
    Sep 30, 2003
  2. Stevey

    N-ary tree code?

    Stevey, Apr 9, 2005, in forum: Java
    Replies:
    1
    Views:
    3,734
    Abhijat Vatsyayan
    Apr 10, 2005
  3. n-ary tree

    , Oct 22, 2006, in forum: C++
    Replies:
    1
    Views:
    977
    Daniel T.
    Oct 22, 2006
  4. Replies:
    4
    Views:
    932
    Bo Persson
    Apr 14, 2008
  5. cgirl
    Replies:
    1
    Views:
    471
    Ben Bacarisse
    Jun 26, 2009
Loading...

Share This Page