Semester : S1 and S2
Subject : Computer Programming
Year : 2018
Term : MARCH
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:11
A recursive procedure or routine is one that has the ability to call itself. A recursive expression is
a function, algorithm, or sequence of instructions (typically, an IF, THEN, ELSE sequence) that
loops back to the beginning of itself until it detects that some condition has been satisfied.
Basis For Comparison
Recursion
Iteration
termination condition
(base case) is specified.
Basic The statement in a body of|Allows the set of instructions to
function calls the function itself. |be repeatedly executed.
Format 11 recursive function, 019 சாகா includes initialization,
condition, execution of statement
within loop and update
(increments and
decrements) the control variable.
ermination
conditional statement [5 م
included in the body of the
function to force the function to
return without recursion call
being executed.
7೧೮ iteration statement 15
repeatedly executed until a
certain condition is reached.
Condition
If the function does not converge
to some condition called (base
case), it leads مغ infinite
recursion.
If the control condition in the
iteration statement never
become false, it leads to infinite
iteration.
Infinite Repetition
Infinite recursion can crash the
system.
Infinite loop uses CPU cycles
repeatedly.
code.
Applied Recursion is always applied to|lteration is applied to iteration
functions. statements or "loops".
Stack he stack is used to store the set |Does not uses stack.
of new local variables and
parameters eachtime the function
is called.
Overhead Recursion possesses the overhead |No overhead of repeated function
lof repeated function calls. call.
Speed Slow in execution. Fast in execution.
Size of Code Recursion reduces the size of the |Iteration makes the code longer
12.