CIS 1500 Chapter Notes - Chapter 11: Binary Search Algorithm
Document Summary
Recursive algorithm solves a problem by breaking it into smaller problems. The base case is what the recursive algorithm describes to be done. The term recursive refers to a repeated algorithm by other smaller applications of the same problem. When a function calls other functions it is called a recursive function. Binary search halves a range starting at the midpoint. Use many print statements to see where something went wrong. Add a parameter to print spaces to see how deep it went into the recursion. Conditional compilation is a more advanced way to debug. Common error is to not cover every base case! Common error is to write a base case that is never met!