what is recursive definition defined in detail with examples?
Recursive can be defined as a process in which a function calls itself as a subroutine allowing the function to be repeated several times, since it calls itself during its execution. A recursive function has a recursive case and the base case, where the recursive case is when the function calls itself while the base case is when the function terminates calling itself.
An example is when one is trying to write a program to find the maximum value in a list of numbers in which case the maximum value is either the first number or the largest value in the remaining list.
Another example is when computing a factorial math problem
Comments
Leave a comment