title: Java find the route of seeking node in a tree
body: <pre><code>public List&lt;Person&gt; getDiseaseRouteTo(Person c){
  
      if(this.contains(c)){
          if(root == c){
              route.add(c);
          }
          else if(root != c){
              route.add(root);
              for(DiseaseTree dt: children){
                  if(dt.contains(c)){
                      route.add(dt.root);
                      dt.getDiseaseRouteTo(c);
  
                  }
              }
          }
          return route;
      }
      return null; 
  }
  </code></pre>
  
  <p>The constructor is a tree constructor named DiseaseTree which contain a root node and a Children set. The children set is a DiseaseTree set. I am supposed to find the route of seeking one node. For example, I have an existed tree named ddtt and I want to find the route to find node c in this tree. ddtt.getDiseaseroute(c) will get a list to find node c. like[A, B, C] if tree is like 
  A
  --B
  ----C</p>
  
  <p>I used recursion to realize that. But it can't have complete route. I don't know what is going on and totally confused. </p>