In: Computer Science
Recursion Discussions Question: Why would you want to use recursion? Concerning programming, when would you want to use iterative vs. recursive programming? Where does coding fit in concerning the software process (i.e. its use in design, in coding, etc.)? Describe recursion problems, and why does it seem to fit with recursion? (e.g. nature, math, music, sports game, etc.)
Please upvote if you are able to understand this and if there is any query do mention it in the comment section.
Recursion should be used when there is a problem and that problem is capable of getting broken down to smaller pieces which may represent a problem itself. When problem seems to be not to handled by a simple approach like iterative approach then recursive approach is required.
Both the iterative and recursive programming are used executing set of statements repeatedly for a period of time as specified by the user. But if a problem has branches then recursive programming is preferred. Iterative programming is used for a simpler approach.
Coding is used to transform the use case to the real implementation of the process and when a use case and recursion is used to write a set of statements which have to be used to be used repeatedly in the production of the software.
Recursion problems can be:
Performing different sorting techniques like bubble sort, insertion sort etc. In sorting a function will be created that will keep on calling itself until the entire data of the array is not sorted.
If this was supposed to be done in any other way or there is still any doubt then please mention in the comment section otherwise please upvote.