while activation records are an efficient way to support method calls they can build up very quickly recursive algorithms can exhaust the stack size allocated to the thread fairly fast given the chance just about now we should be dusting the cobwebs off the age old example of an iterative vs recursive solution in the form of the fibonacci algorithm this is famous example as it highlights both the beauty and pitfalls of recursive algorithm the iterative solution is not as prettynor self documenting but it does the job lot quicker if we were to give the fibonacci algorithm an input of say then we would have to wait while to get the value back because it has an ( run time the iterative version on the other hand has (nrun time don' let this put you off recursion this example is mainly used to shock programmers into thinking about the ramifications of recursion rather than warning them off some problems are recursive in nature something that you may come across is that some data structures and algorithms are actually recursive in nature perfect example of this is tree data structure common tree node usually contains valuealong with two pointers to two other nodes of the same node type as you can see tree is recursive in its makeup wit each node possibly pointing to two other nodes when using recursive algorithms on tree' it makes sense as you are simply adhering to the inherent design of the data structure you are operating on of course it is not all good newsafter all we are still bound by the limitations we have mentioned previously in this we can also look at sorting algorithms like merge sortand quick sort both of these algorithms are recursive in their design and so it makes sense to model them recursively summary recursion is powerful tooland one that all programmers should know of often software projects will take trade between readabilityand efficiency in which case recursion is great provided you don' go and use it to implement an algorithm with quadratic run time or higher of course this is not rule of thumbthis is just us throwing caution to the wind defensive coding will always prevail many times recursion has natural home in recursive data structures and algorithms which are recursive in nature using recursion in such scenarios is perfectly acceptable using recursion for something like linked list traversal is little overkill its iterative counterpart is probably less lines of code than its recursive counterpart because we can only talk about the implications of using recursion from an abstract point of view you should consult your compiler and run time environment for more details it may be the case that your compiler recognises things like tail recursion and can optimise them this isn' unheard ofin fact most commercial compilers will do this the amount of optimisation compilers can