Table of Contents
Why would you prefer to use recursion?
Recursion is made for solving problems that can be broken down into smaller, repetitive problems. It is especially good for working on things that have many possible branches and are too complex for an iterative approach. One good example of this would be searching through a file system.
How is recursion used in real life?
In programming terms, recursion happens when a function calls itself. If you have a problem that is too complex, you can use recursion to break it down into simpler blocks. You do this in real life all the time. Imagine you have a whole box full of $100 bills and you need to count how much money you have.
How would you describe recursion to a child?
Recursion, in programming, is a function that “starts” itself (again). That’s really all. There’s a children’s song in my country that every four year old knows by heart, and luckily, it’s a recursive song. It’s about determining what day of the week it is.
What is recursion and class?
Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. void recursion() { recursion(); /* function calls itself */ } int main() { recursion(); }
Can you give a real life example of recursion?
Some sixty kilometers south of Manila is one of the greatest examples of recursion in real life that I know. That would be Lake Taal and the Taal Volcano. We like to say that Taal is “a volcano within a volcano”, complete with picturesque views from Tagaytay City and other towns around the shores of Lake Taal.
How do you explain recursion to your grandmother?
, Always Learning….
- Bring two big mirrors.
- Put them parallel to each other.
- Take your grandmother between this arrangement ,facing towards any of the mirror.
- Shout – “Look granny! This is Recursion.”