Recursion - PowerPoint PPT Presentation

About This Presentation
Title:

Recursion

Description:

Recursion. To understand recursion, you have to understand recursion... Nicolas Pelletier ... A very powerful way of resolving problems. Eliminates long and ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 9
Provided by: angel115
Category:

less

Transcript and Presenter's Notes

Title: Recursion


1
Recursion
  • To understand recursion, you have to understand
    recursion
  • Nicolas Pelletier

2
Recursion calling yourself
  • A very powerful way of resolving problems
  • Eliminates long and complex solutions
  • Revolution in programming
  • Dangerous as it can go into an infinite loop
  • Can create memory leaks

3
The String reverser
This case was easy to solve, so we will use it to
demonstrate recursion
4
Here is a new way
5
How???
  • doIt(Bishops College School)
  • return l doIt(Bishops College Schoo)
  • return o doIt(Bishops College Scho)
  • return o doIt(Bishops College Sch)
  • return h doIt(Bishops College Sc)

6
Continued
7
Other example
8
Assignment 10
  • Write a recursive method in a class that solves
    the following problem
  • The method should order a list of letters (a
    string) from decreasing alphabetical order, from
    z to a
  • The list should contain 10-15 letters
Write a Comment
User Comments (0)
About PowerShow.com