Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@manish-r2Hoep • Sep 27, 2009
Re: Recursion..
see recursion means a function calls repeatedly
It uses system stack to accomplish it's task....as stack uses last in last out approach
and when a function is called the controlled is moved to where function is defined which has it is stored in memory with some address this address is stored in stack
second recursion is very interesting ....
it reduces a time complexity of a program for eg
say you have created a program for mergesort which uses recursion ie divide and conquer approach and insertion sort which uses normal programming
now from time complexity point of view you will choose only merge sort to sort a array
as it has time complexity of nlogn
and insertion sort has n*n
2:-it haS disadvantage also
it involves a lot of memory wastage
and very much typical concept to understand