# JCL

FEUP/DEI & INESC TEC

### Site Tools

teach:fpro:lectures:14

# LE14: 03/12/2020

Master in Informatics and Computing Engineering
Programming Fundamentals
Instance: 2020/2021

# Lecture #14 :: 03/12/2020

## Goals

By the end of this class, the student should be able to:

• Identify some complex problems, that may otherwise be difficult to solve, that may have a simple recursive solution
• Describe how to formulate programs recursively
• Describe recursion as a form of iteration
• Implement the recursive formulation of a problem

## Content

• Recursion
• Case study: Tower of Hanoi
• Iteration vs. Recursion
• Calculating the sum of a list of numbers
• Factorial
• Fibonacci
• Is a palindrome
• Converting to any base
• Summary

## Bibliography

• Brad Miller and David Ranum, Problem Solving with Algorithms and Data Structures using Python, [HTML] (Chapter 5)

## Summary

• Recursive case studies: Tower of Hanoi. Recursion versus Iteration: Calculating the sum of a list of numbers, Factorial, Fibonacci, Palindrome, Converting to any base.

FPRO, 2020/21 