SlideShare a Scribd company logo
Lecture Note-9: Recursion 2015
By Rajesh K Shukla, HOD, Department of CSE, SIRT Bhopal
Downloaded from www.RajeshkShukla.com
Comparison of Recursion and Iteration
S
No
Recursion Iteration
1 When a function call itself it is
called Recursion
In Iteration set of statement are
executed repeatedly until some
specified condition is satisfied
2 Recursion is based on the base
condition, execution of stamen
moving towards the base
condition
Iteration is based on the
initialisation, termination
condition, updation and
execution
3 Recursion is a top down approach Iteration is bottom up approach
4 Recursion run out of memory if
base condition is not Checked
Iteration results in infinite loop
if termination condition is not
met
5 Recursion takes more space to
store new set of local variables
Iteration does not much time as
compared to recursion
6 Recursion is not efficient Iteration is efficient
7 Every Recursive algorithm can be
converted in to Iterative version
Every iterative method cannot
be converted into recursive
version
8 For Proper function recursion
saves the return address
Iterative method does not save
the return address
9 Recursion uses Stack for
temporary storage
Stacks are not required in
implementing Iterative
algorithms

More Related Content

PPTX
1.1. the central concepts of automata theory
Sampath Kumar S
 
PPTX
Process synchronization
Syed Hassan Ali
 
PPTX
Problem solving agents
Megha Sharma
 
PPTX
Code Optimization
Akhil Kaushik
 
PPTX
Propositional logic
Rushdi Shams
 
PPTX
Yacc
BBDITM LUCKNOW
 
PDF
Lecture 1 - Game Theory
Luke Dicken
 
1.1. the central concepts of automata theory
Sampath Kumar S
 
Process synchronization
Syed Hassan Ali
 
Problem solving agents
Megha Sharma
 
Code Optimization
Akhil Kaushik
 
Propositional logic
Rushdi Shams
 
Lecture 1 - Game Theory
Luke Dicken
 

What's hot (20)

PPTX
Evolution of operating system
Arshad khan
 
PPTX
Decision properties of reular languages
SOMNATHMORE2
 
PDF
Dbms 14: Relational Calculus
Amiya9439793168
 
PPTX
weak slot and filler structure
Amey Kerkar
 
PPTX
Types of environment in Artificial Intelligence
Noman Ullah Khan
 
PPTX
Memory Organization
Kamal Acharya
 
PPTX
Memory organization (Computer architecture)
Sandesh Jonchhe
 
PPTX
Problem Formulation in Artificial Inteligence Projects
Dr. C.V. Suresh Babu
 
PDF
A* Search Algorithm
vikas dhakane
 
PDF
I. Alpha-Beta Pruning in ai
vikas dhakane
 
PPTX
Control Strategies in AI
Amey Kerkar
 
PPTX
Interrupts
Urwa Shanza
 
PPT
Multi Head, Multi Tape Turing Machine
Radhakrishnan Chinnusamy
 
PPTX
AI3391 Artificial intelligence Session 22 Cryptarithmetic problem.pptx
Guru Nanak Technical Institutions
 
PPT
Presentation on operating system
Nitish Xavier Tirkey
 
PPTX
Semophores and it's types
Nishant Joshi
 
PDF
Semaphores
Mohd Arif
 
PPTX
Depth first search [dfs]
DEEPIKA T
 
PDF
I.BEST FIRST SEARCH IN AI
vikas dhakane
 
PPTX
Timing and control
chauhankapil
 
Evolution of operating system
Arshad khan
 
Decision properties of reular languages
SOMNATHMORE2
 
Dbms 14: Relational Calculus
Amiya9439793168
 
weak slot and filler structure
Amey Kerkar
 
Types of environment in Artificial Intelligence
Noman Ullah Khan
 
Memory Organization
Kamal Acharya
 
Memory organization (Computer architecture)
Sandesh Jonchhe
 
Problem Formulation in Artificial Inteligence Projects
Dr. C.V. Suresh Babu
 
A* Search Algorithm
vikas dhakane
 
I. Alpha-Beta Pruning in ai
vikas dhakane
 
Control Strategies in AI
Amey Kerkar
 
Interrupts
Urwa Shanza
 
Multi Head, Multi Tape Turing Machine
Radhakrishnan Chinnusamy
 
AI3391 Artificial intelligence Session 22 Cryptarithmetic problem.pptx
Guru Nanak Technical Institutions
 
Presentation on operating system
Nitish Xavier Tirkey
 
Semophores and it's types
Nishant Joshi
 
Semaphores
Mohd Arif
 
Depth first search [dfs]
DEEPIKA T
 
I.BEST FIRST SEARCH IN AI
vikas dhakane
 
Timing and control
chauhankapil
 
Ad

Viewers also liked (15)

PDF
Module 01 Stack and Recursion
Tushar B Kute
 
PPT
Super ontology stack_review_m36_051
John Domingue
 
PDF
Pop operation
Rajesh K Shukla
 
PDF
Quiz 2
Rajesh K Shukla
 
DOC
Graphical representation of Stack
Sanjay Kumar Chakravarti
 
PPT
Stack Implementation
Zidny Nafan
 
PPTX
Stack in microprocessor 8085(presantation)
Safin Biswas
 
PPSX
Stacks Implementation and Examples
greatqadirgee4u
 
PPTX
Stack data structure
Tech_MX
 
PDF
Applications of stack
eShikshak
 
PPSX
Stack
Seema Sharma
 
PPTX
STACKS IN DATASTRUCTURE
Archie Jamwal
 
PPT
DATA STRUCTURES
bca2010
 
PDF
Data structure and algorithm with java implementation by obaid kakar
Obaid Kakar
 
Module 01 Stack and Recursion
Tushar B Kute
 
Super ontology stack_review_m36_051
John Domingue
 
Pop operation
Rajesh K Shukla
 
Graphical representation of Stack
Sanjay Kumar Chakravarti
 
Stack Implementation
Zidny Nafan
 
Stack in microprocessor 8085(presantation)
Safin Biswas
 
Stacks Implementation and Examples
greatqadirgee4u
 
Stack data structure
Tech_MX
 
Applications of stack
eShikshak
 
STACKS IN DATASTRUCTURE
Archie Jamwal
 
DATA STRUCTURES
bca2010
 
Data structure and algorithm with java implementation by obaid kakar
Obaid Kakar
 
Ad

More from Rajesh K Shukla (7)

PDF
Quiz 1
Rajesh K Shukla
 
PDF
Little o and little omega
Rajesh K Shukla
 
PDF
Theta notation
Rajesh K Shukla
 
PDF
The bog oh notation
Rajesh K Shukla
 
PDF
Big omega
Rajesh K Shukla
 
PDF
Lecture Note-1: Algorithm and Its Properties
Rajesh K Shukla
 
PDF
Lecture Note-2: Performance analysis of Algorithms
Rajesh K Shukla
 
Little o and little omega
Rajesh K Shukla
 
Theta notation
Rajesh K Shukla
 
The bog oh notation
Rajesh K Shukla
 
Big omega
Rajesh K Shukla
 
Lecture Note-1: Algorithm and Its Properties
Rajesh K Shukla
 
Lecture Note-2: Performance analysis of Algorithms
Rajesh K Shukla
 

Recently uploaded (20)

PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 

Stack: Recursion and Iteration

  • 1. Lecture Note-9: Recursion 2015 By Rajesh K Shukla, HOD, Department of CSE, SIRT Bhopal Downloaded from www.RajeshkShukla.com Comparison of Recursion and Iteration S No Recursion Iteration 1 When a function call itself it is called Recursion In Iteration set of statement are executed repeatedly until some specified condition is satisfied 2 Recursion is based on the base condition, execution of stamen moving towards the base condition Iteration is based on the initialisation, termination condition, updation and execution 3 Recursion is a top down approach Iteration is bottom up approach 4 Recursion run out of memory if base condition is not Checked Iteration results in infinite loop if termination condition is not met 5 Recursion takes more space to store new set of local variables Iteration does not much time as compared to recursion 6 Recursion is not efficient Iteration is efficient 7 Every Recursive algorithm can be converted in to Iterative version Every iterative method cannot be converted into recursive version 8 For Proper function recursion saves the return address Iterative method does not save the return address 9 Recursion uses Stack for temporary storage Stacks are not required in implementing Iterative algorithms