Computer Programming
Database Design
Computer Science

What is recursive algorithm?

Top Answer
User Avatar
Wiki User
Answered 2014-12-18 08:04:03

Algorithm can be defined as an interpretable, finite set of instructions for dealing with contigencies and accompanying task that has recognizable end-points for given inputs. It is a tool for solving a well computational problem. A recursive algorithm is one which calls itself.

User Avatar

User Avatar
Wiki User
Answered 2009-04-08 09:26:15

A recursive program/algorithm is one that calls itself again.

User Avatar

Your Answer

Still Have Questions?

Related Questions

When you choose iterative or recursive algorithm?

If you cannot find any iterative algorithm for the problem, you have to settle for a recursive one.

What are properties of recursive algorithm?

a function that calls itself.

What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))

Recursive algorithm to check a no is prime or not?

Suck a dick until it works

What causes a recursive algorithm to stop calling itself?

If the condition has been reached.

How do you write recursive algorithm?

Any algorithm, that refers to itself is recursive. Trivial example: gcd (a, b) := a if b=0 b if a=0 gcd (a mod b, b) if a>=b gcd (b mod a, a) if a<b

How can you convert a simple algorithm to recursive algorithm?

Linear search(a,item) n=length(a) for i=1 to n do if(a[i]==item) then return i end for return -1

What is recursive algorithm and write a recursive algorithm to reverse a string also trace it for any string data?

A recursive algorithm is an algorithm which calls itself with "smaller (or simpler)" input values, and which obtains the result for the current input by applying simple operations to the returned value for the smaller (or simpler) input. Heres a recursive algorithm to reverse a string char *rev(char str[],int pos1,int pos2) { if(pos1<pos2) { char temp=str[pos1]; str[pos1]=str[pos2]; str[pos2]=temp; return rev(str,pos1+1,pos2-1); } return str; } You can call this function like this char *r=rev("reverse it",0,9);

Explain non-recursive and recursive algorithm for postorder traversal on binary tree?

Step 1:- select first root node (t), start travelsing left contin

Design recursive algorithm for computing 2n for any non negative integer n which is based on the formula2n2n-1 2n-1?

The formula, as far as I can see, is not appropriate for the algorithm.

How do you do algorithm?

n.A step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps.Read more: algorithm

Why recursive and non-recursive delivers wrong result?

Recursive and non-recursive (also known as iterative) are simply two different approaches to solving a problem. Properly implemented, they should give the same result. If they do not, then something is wrong, and you should spend the time to figure out why.This is a generic answer, because the topic is too broad to answer here, as there are many different reasons that a particular algorithm may fail.

Write and explain recursive backtracking algorithm for n-queens?

This is not a question, this is your homework. For a start, read this:

What is the recursive algorithm for find the factorial of n?

int fact(n) { return (n == 2 ? 2 : n * fact(n-1)); }

What is the algorithm of the c program to find a factorial-recursive function?

Algorithm: fact (n) Input: n (a positive integer) Output: the product of [1:n] e.g., (123*...*n) Begin: if n

How do you choose between recursion and iteration?

Some problems cry out for recursion. For example, an algorithm might be defined recursively (e.g. the Fibonacci function). When an algorithm is given with a recursive definition, the recursive implementation is straight-forward. However, it can be shown that all recursive implementations have an iterative functional equivalent, and vice versa. Systems requiring maximum processing speed, or requiring execution within very limited resources (for example, limited stack depth), are generally better implemented using iteration.

Write a recursive algorithm to find the factorial of a number?

int fact (int n) { if (n==0) return 1; return n* fact(n-1); }

Which data structure would you most likely see in a nonrecursive implementation of a recursive algorithm?

Probably, you would see a stack.A recursive algorithm works by calling itself, each time with different data. So, to simulate that without actual recursion, you would need to track the changing data on some kind of stack. This would allow the data to be processed in a last-in-first-out order, which is how recursion works.

How can you differentiate between recursive and non recursive functions?

See if the fuction calls itself, if yes, it's recursive otherwise it's not a recursive function.

Design a non recursive algorithm for the towers of hanoi puzzle?

I don't want to spoil your fun, let it be sufficient to say that it is not trivial, but not that hard either. If you are to lazy to do it, consult wikipedia (attached link).

What does the word recursive mean?

Something that is recursive is something that repeats.

Are all recursive programs non recursive?

None of them is, obviously.

What is the definition of recursive?

The term recursive refers to the recurrence or repetition.

What is set difference between recursive and recursively enumerable but not recursive?

All recursive Languages are recursively enumerable. But not all the recursively enumerable languages are recursive. It is just like NP complete.

How do you overcome limitations of stacks in polygon filling?

You overcome limitations of the stack in polygon filling, or in any other algorithm, far that matter, but using an iterative technique, rather than a recursive technique. Recursion is quite useful, and can simplify algorithm design. Polygon filling, however, is a class of algorithm can potentially have a very deep recursion depth. This causes stress on the stack, hence the need for iteration.

Still have questions?