Course Hero Logo

More Basic Algorithms.txt - Recursion means that the...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 2 pages.

Recursion means that the function or method is calling itself to get the solution.The main benefit of using this functionality is having less lines of code.You will notice the implementation of the printFun method. The printFun methodcalls itself several times to resolve the issues. This is what is referred to asrecursion—that is, a function or method that calls itself to resolve an issue. Thefollowing list shows the major advantages and disadvantages of using recursivefunctions:AdvantagesThe same method calls itselfReduces the number of lines of codeDisadvantagesUses more processing powerDifficult to trace and debug the issueBacktrackingBacktracking means solving the problem with many available options. For instance,say that you have a problem. A problem can be solved by using n different ways. Youcan select a way and see whether the problem is solved or not. If the problem issolved, then the program is complete. You need to backtrack and use anotheralternative to resolve the problem if it is not resolved. The problem is unresolvedif you have to try with all possible moves, and there is still no success.

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags
Recursion, following list, Backtracking algorithm

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture