Recursion

  1. Recursion:

  2. Example: a LIST of Numbers

    Example: a recursive definition of the term "LIST"
          LIST  ::=   NUMBER   or   NUMBER , LIST     
    
    
    Examples:
    
              LIST =   5
              LIST =   8
              LIST =   5,8
              LIST =   5,5,8
              LIST =   9,5,5,8
    		   ....
    

  3. NOTE: there is ALWAYS a base case that is NOT recursive
    (This base case is necessary to stop the recursion)