+ 1

How to use Recursion?

How can i use recursion in my programs?i learnt all the concepts but haven't figured out what to do with recursion..

8th Sep 2018, 4:17 AM
Mensch
Mensch - avatar
3 Respostas
+ 11
recursion means function itself calls again and again. you can get some information how to use it in this lesson https://www.sololearn.com/learn/CPlusPlus/1641/?ref=app
8th Sep 2018, 4:49 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 2
Tyrant it can be used to have iteration of something.... you may like to have a look at below code : https://code.sololearn.com/cXR5MecFS5WR/?ref=app https://code.sololearn.com/cv1cBQf6pfQF/?ref=app
8th Sep 2018, 4:48 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Recursion is used wide. For example you have a data structure like a tree. Each node of the tree is a class. You call a function at the root element. It performs some action and calls the same function for each child. It is completely the same function, but executed for other instance of class or it's inheritance. Most of User Interfaces are implemented in this way by inheriting all UI controls from the base UIItem an organizing them into a tree.
8th Sep 2018, 5:35 AM
Sergey Ushakov
Sergey Ushakov - avatar