title: Given a binary search tree, find the node with largest value of ocurrences
body: <p>I have a BST declared like this:</p>
  
  <pre><code>struct nodeABB {
     int data;
     int ocurr;
     nodeABB *left;
     nodeABB *right;
  };
  </code></pre>
  
  <p>The "ocurr" value save how many times the same data was inserted in the tree.</p>
  
  <p>I need a recursive algorithm to find the node with the largest "ocurr" value, if there are two nodes with the same value the idea is to return the one with the largest data.</p>
  
  <p>Edit: Mi last try:</p>
  
  <pre><code>trypedef nodeABB* ABB;
  ABB Max(ABB a) {
  ABB ret = NULL;
    if (!a) 
      return ret;
  
  ABB a1 = Max(a-&gt;left);
  ABB a2 = Max(a-&gt;right);
  
  if (a1 &amp;&amp; a2) {
      int n1 = a1-&gt;ocurr;
      int n2 = a2-&gt;ocurr;
      if (n1 &gt; n2) 
          ret = a1;
      else if (n1 &lt; n2)
          ret = a2;
      else
          ret = (a1-&gt;data &lt; a2-&gt;data ? a1 : a2);
  } else if (!a1 &amp;&amp; a2)
       ret = a2;
  else if (a1 &amp;&amp; !a2)
      ret = a1;
  
  return ret;
  }
  </code></pre>