Lecture 8: Recursion

Computer Programming

J Mwaura

Void Recursive Functions

Value-Returning Recursive Functions

Recursive Algorithms - Sum & Factorial

Recursive Algorithms - GCD

Recursive Algorithms - Fibonacci

Reversing a String

Palindromes

Recursive Sort & Search

Read on;

  • Quick sort - partition algorithm
  • Binary search
  • Recursive binary search

The Towers of Hanoi

The task uses the following rules:

  • Only one disk can be moved at a time
  • A larger disk must never be stacked above a smaller one
  • One temporary peg (B) is used for the intermediate storage of disks

Bitbucket: Hanoi


Home: Hanoi

End of Lecture 8

Computer Programming

That's it!

Queries about this Lesson, please send them to: jmwaura.uni@gmail.com

*References*

  • C++ Programming - An Object-Oriented Approach, 2019 Behrouz, Richard et.al
  • Accelerated C++ - Practical Programming by Example, 2000 Andrew, Barbara et.al
Courtesy of
Computer Programming