title: how to find the second largest value in the tree
body: <p>I am not getting the logic of how to find the second largest element in a tree.</p>
  
  <pre><code>public static int largestR(TreeNode&lt;Integer&gt; root){
      if(root==null){
          return Integer.MIN_VALUE;
      }
  
      int max=root.data;
      for(int i=0;i&lt;root.children.size();i++){
  
          int n=largestR(root.children.get(i));
          if(max&lt;n){
              max=n;
          }
      }   
      return max;
  }
  </code></pre>
  
  <p>The tree is not binary a node can have any number of children .</p>
  
  <p>It would be great if you can give me algorithm of code for its solution</p>
  
  <p>Thanks.</p>