 J. Correia Lopes

FEUP/DEI & INESC TEC

Site Tools

teach:fpro:lectures:18

T: 29/11/2018

Master in Informatics and Computing Engineering
Programming Fundamentals
Instance: 2018/2019

Lecture #18 :: 29/11/2018

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

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

Bibliography

• Brad Miller and David Ranum, Problem Solving with Algorithms and Data Structures using Python (Chapter 4) HTML
• Brad Miller and David Ranum, Learning with Python: Interactive Edition. Based on material by Jeffrey Elkner, Allen B. Downey, and Chris Meyers (Chapter 15) HTML

Summary

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

FPRO, 2018/19 