Which of the following scenarios is the most suitable for applying recursion? 

  • Iterating through elements in an array. 
  • Calculating the total sales of a company. 
  • Solving problems that have repetitive structures. 
  • Creating graphical user interfaces.
Recursion is particularly suitable for problems that exhibit repetitive or nested structures. Examples include problems like calculating factorial, traversing trees, or solving the Towers of Hanoi. Such problems can be broken down into smaller instances of the same problem, making them perfect candidates for a recursive approach.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *