Cards (7)

  • Recursion is the process of repeatedly calling a function on itself until a condition is met.
  • A recursion function has three characteristics:
    • A base case
    • Stopping condition after a finite number of calls
    • Input values aside from the stopping condition
  • An infinite recursion occurs when a recursion never reaches a stopping condition, and continues making recursive calls forever.
  • During recursion, a call stack keeps track of the address of the instruction that control should return to when a function ends, also known as the return address.
  • A call stack consists of:
    A) Local Variables
    B) Return Address
    C) Parameters
    D) Stack Frame
  • Recursive algorithms are often much shorter, but more difficult to trace through than an iterative algorithm.
  • If a recursive function is called a very large number of times before the stopping condition is reached, the program may crash with a "stack overflow" error.