what is recursive function?
function which progress with previous values.
It's a function that calls itself to produce result. It is generally used as an alternative to iteration (looping). The program written using it is short but little difficult to understand. Once you master it, you will be equipped with one of the good skills of programming.
^What he said. Plus read there http://en.wikipedia.org/wiki/Recursion http://en.wikipedia.org/wiki/Recursion_%28computer_science%29 Its the 'aha' moment of computer science when you can fully understand it -_-
ask a recursive function... which will, of course, ask itself...
A recursive function solves part of a problem. By repeatedly calling itself, it eventually solves the entire problem. One problem that can be solved recursively is converting numbers from one base to another, ie. from decimal to hexadecimal. In Python: characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" def mkDigit( number, base ): if( number == 0 ): return "" index = number % base number = number // base return mkDigit( number, base ) + characters[ index ] The string of the output number is concatenated on the "unwind".
a function that calls itself for n number of times is called recursive function
Join our real-time social learning platform and learn together with your friends!