972 views
5 votes
Recursion can be a powerful tool for solving repetitive problems? (true , false)

1 Answer

1 vote

Answer:

True

Step-by-step explanation:

Recursion is a powerful programming paradigm for solving problems which can be restated as a combination of subproblems of the same type. Some common examples include:

1) factorial(n) = n* factorial(n-1);

Here factorial of a number is expressed as a product of the number and the factorial of the number decremented by 1.

2) treesearch(node,value)) = treesearch(left,value) || treesearch(right,value)|| (root==value)

Here we are searching for a value in a tree. This can be expressed recursively as a boolean OR of search result on left and right subtrees and the search result for the root of the tree.

User Bente
by
7.6k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.