Main Article Content

Evaluation, computation and coding of iterative function using recursive approach


G. A. Otu
M.S. Oyebanji
F. I. Okonkwo
R.U. Ugbe
A. C. Okafor
S. A. Usman
O. A Ubadike

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.


Journal Identifiers


eISSN: 2635-3490
print ISSN: 2476-8316