0% found this document useful (0 votes)
10 views56 pages

16 Introduction To Recursion

Recursion is a problem-solving technique used in various fields, including computer science, that involves breaking down complex problems into simpler, manageable parts. The document provides examples such as gifting empty boxes and Matryoshka dolls to illustrate recursion. It also outlines a general recipe for implementing recursive functions, including base and recursive cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views56 pages

16 Introduction To Recursion

Recursion is a problem-solving technique used in various fields, including computer science, that involves breaking down complex problems into simpler, manageable parts. The document provides examples such as gifting empty boxes and Matryoshka dolls to illustrate recursion. It also outlines a general recipe for implementing recursive functions, including base and recursive cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Recursion

Mohd Ayyoob
([Link] CSA, IISc Banglore)
What is Recursive function?
What is Recursion?
What is Recursion?

Recursion is a technique used in many disciplines, including computer science, linguistics, and logic, to solve
problems by breaking them down into simpler, more manageable parts
What is Recursion?

Recursion is a technique used in many disciplines, including computer science, linguistics, and logic, to solve
problems by breaking them down into simpler, more manageable parts

Eg 1 : Gifting Empty Boxes


What is Recursion?

Recursion is a technique used in many disciplines, including computer science, linguistics, and logic, to solve
problems by breaking them down into simpler, more manageable parts

Eg 2 : Matryoshka Doll
What is Recursion?

Recursion is a technique used in many disciplines, including computer science, linguistics, and logic, to solve
problems by breaking them down into simpler, more manageable parts

Eg 3 : Recursion
Reference : CS106B/Stanford
Reference : CS106B/Stanford
Reference : CS106B/Stanford
GENERAL RECIPE :

recursive():
if (test for simple case) :
// base case
Compute the solution without recursion
else :
// recursive case

Break the problem into subproblems of the same form Call recursive() on
each self-similar subproblem
Re assemble the results of the subproblems

You might also like