1) Recursive function – is a function that is partially defined by itself whereas Iterative functions – are loop based imperative repetitions of a process
2) Recursion Uses selection structure whereas Iteration uses repitation structure
3) An infinite loop occurs with iteration if the loop-continuation test never becomes false whereas infinite recursion occurs if the recursion step does not reduce the problem in a manner that converges on the base case.
4) Iteration terminates when the loop-continuation condition fails whereas recursion terminates when a base case is recognized
5) When using recursion multiple activation records are created on stack for each call when in iteration everything is done in one activation record
6) Recursion is usually slower then iteration due to overhead of maintaining stack whereas iteration does not use stack so it's faster than recursion
7) Recursion uses more memory than iteration
8) Infinite recursion can crash the system whereas infinite looping uses cpu
cycles repeatedly
9) Recursion makes code smaller and iteration makes code longer
thank u very much
ReplyDeleteIndeed great compilation, worth looking. By the way iteration is the way to go in production because deep recursion can blow Stack. here is a program to reverse String with recursion and iteration which help to understand both.
DeleteYou are right about recursion. Many times I got error in python that says "Maximum stack limit is reached" and program stops.
DeleteThanks a lot...
ReplyDeleteBest answer...
Your welcome Raja.
ReplyDeletegot an xam 2day and dis was very very helpful.
ReplyDeletePleased to know that article was helpful to you.
Deleteme to having exam tomorow
Deletethks........... nd help fr exms.......
ReplyDeletebest answer
ReplyDeletegood n thanks
ReplyDeleteGreat effort, man. Got an exam tomorrow. You were of immense help.
ReplyDeleteThanks Soham. Glad to know that article was helpful to you man.
Deletethanks
ReplyDeleteand will u please tell me
which one is most preparable
justify it
IMHO it depends on situation. Recursion creates lots of stack frames. In some programming languages no of stack frames that can be created, are limited. So iteration is preferable.
Deletemake it fast damn it
ReplyDeletethank you very much. I really needed it
ReplyDeleteThank u very much!! You just saved my assignment marks :-p lol!
ReplyDeletethanq very much useful!!
ReplyDeleteGr8 Post! Thnx a lot..
ReplyDeletethank u ,, it is very useful to me in today's condition
ReplyDeleteI really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Data Science with Python , kindly contact us http://www.maxmunus.com/contact
ReplyDeleteMaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us.
Sangita Mohanty
MaxMunus
E-mail: sangita@maxmunus.com
Skype id: training_maxmunus
Ph:(0) 9738075708 / 080 - 41103383
http://www.maxmunus.com/
Well explained string operation .
ReplyDeletethere are good String program collection visit Top String program
I’m impressed, I must say. Seldom do I come across a blog that’s both educative and interesting, and without a doubt, you have hit the nail on the head. The problem is an issue that not enough folks are speaking intelligently about. Now i'm very happy I stumbled across this during my hunt for something regarding this.
ReplyDeletetnmachi