Re: Determining the height of a non-binary tree

[email protected]
Newsgroups gmane.comp.ai.weka
Message-ID <162452671503.117859.15759215717960274853@sys-mailman-prd.its.waikato.ac.nz>
I have made a small change to the code. The fact is 
that I can not get the content of the children with
m_sons[i].m_train !

int getHeight(Instances data){
    int height=0;
    if (data==null){
      return 0;
    } else {
      for (int i=0; i<m_sons.length; i++) {
        if (i == 0) {
          height = getHeight(m_sons[i].m_train);
        } else {
          int currentHeight = getHeight(m_sons[i].m_train);
          if (currentHeight > height) {
            height = currentHeight;
          }
        }
      }
      return height + 1;
    }
  }

Any help will be valuable!
Thank you in advance,

Spyros Halkidis
_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.