The IRMA Community
Newsletters
Research IRM
Click a keyword to search titles using our InfoSci-OnDemand powered search:
|
Transforming Recursion to Iteration in Programming
Abstract
The main advantage of a Recursive Algorithm (an algorithm defined in terms of itself) is that it can be easily described and easily implemented in a programming language (van Breughel, 1997). On the other hand, the efficiency of such an algorithm is relatively low because for every recursive call not yet terminated, a number of data should be maintained in a stack, causing time delays and requiring higher memory space (Rohl, 1984). Solving the same problem iteratively instead of recursively can improve time and space efficiency. For example, to solve a problem that involves N recursive procedure calls, it will require stack space linear to N. On the contrary, using iteration, the program will need a constant amount of space, independent of the number of iterations. There are programming languages, such as Prolog, that do not possess built-in iterative structures and so recursion should be used instead. Nevertheless, there are ways to write recursive programs that have similar behaviour with that of the corresponding iterative programs.
Related Content
Tereza Raquel Merlo, Nayana Madali M. Pampapura, Jason M. Merlo.
© 2024.
14 pages.
|
Kris Swen Helge.
© 2024.
9 pages.
|
Ahmad Tasnim Siddiqui, Gulshaira Banu Jahangeer, Amjath Fareeth Basha.
© 2024.
12 pages.
|
Jennie Lee Khun.
© 2024.
19 pages.
|
Tereza Raquel Merlo.
© 2024.
19 pages.
|
Akash Bag, Paridhi Sharma, Pranjal Khare, Souvik Roy.
© 2024.
31 pages.
|
Akash Bag, Upasana Khattri, Aditya Agrawal, Souvik Roy.
© 2024.
28 pages.
|
|
|