Abstract

Iteration and recursion are very pivotal concepts in understanding the logic and building blocks of all computer programs across all programming paradigms. Although the theory of iteration together with the development and implementation of iterative algorithm is easy to grasp, that of recursion remains elusive to programmers especially novice programmers. In this research, functions composition is applied in the explanation of iteration using recursion. The method demonstrates an easy and elaborate way of writing iterative programs using recursion by identifying the significant variables in both constructs. Function composition is used to write the recursive function, the recursive variable is identified as a variable that converges towards the base case, also the base case is also identified as being the terminating point of the function call else the function call runs and fill the stack memory causing stack overflow. The recursive part is the loop update and base case the termination condition in iterative programs. The results obtained simplifies how to write iterative codes using recursion.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.