title: recursion difference in BST data Structure
body: <p>here is BST code by java</p>
  
  <blockquote>
  <pre><code>public class BST&lt;Key extends Comparable&lt;Key&gt;,Value&gt;{
  private Node root ; 
  private class Node{
      private Key key;
      private Value val;
      private Node left,right;
      private int n; 
      public Node(Key key, Value val , int n){
          this.key=key ; this.val=val; this.n=n;
      }
  }
  public int size(){
      return size(root);
  }
  private int size(Node x){
      if(x==null) return 0 ; 
      else return x.n;
  }
  public Value get(Node x, Key key){
      if(x==null) return null;
      int cmp = key.compareTo(x.key);
      if(cmp&lt;0) return get(x.left,key);
      else if(cmp&gt;0) return get(x.right,key);
      else return  x.val;
  }
  public Value get(Key key){
      return get(root,key);
  }
  public void put(Key key , Value val){
      root = put(root,key,val);
  }
  public Node put(Node x ,Key key , Value val){
      if(x==null) return new Node(key,val,1);
      int cmp = key.compareTo(x.key);
      if(cmp&lt;0) x.left = put(x.left,key,value);
      else if(cmp&gt;0) x.right =put(x.right , key value);
      else x.val = val;
      x.n=size(x.left)+size(x.right)+1;
      return  x;
  }
  }
  </code></pre>
  </blockquote>
  
  <p>1 I wonder, Method <code>put</code> and <code>get</code>   are all the recursive function ?
  for me ,why <code>x.left=put(x.left,key,val)</code> ? can i delete   <code>x.left=</code> or replace it with <code>return put(x.left,key,val)</code>? </p>
  
  <p>2 I wonder, in recursive function ,return statement is necessary ? 
  for example in Fibonacci </p>
  
  <pre><code>`public static int recursiveFactorial(int n){
    if (n == 1) return 1;else return n * recursiveFactorial(n-1);
   } `
  </code></pre>
  
  <p>can I delete the second <code>return</code>?</p>