20 likes | 116 Vues
Learn to leverage the power of recursion in designing algorithms for various problems of different sizes. Explore examples like computing factorials, checking palindromes, using binary search, tackling Towers of Hanoi, and implementing merge sort.
E N D
Program Design using Recursion • Recursion is a very powerful design (and programming) technique • Consider using recursion when • Designing algorithm for problem of “size” N, AND • If you’re giving a problem of size N – m, you can add-to or alter that solution to solve the problem of size N.
Example Recursive Designs • Compute N ! (N factorial) • Determine if a string is a palindrome • Binary Search (of a sorted array) • Towers of Hanoi • Merge Sort • MANY data structure problems associated with trees, graphs, lists, …