B2.4 Programming algorithmsB2.4.4

Recursion — Fundamental Concept and Applications (AHL)

Explain the fundamental concept of recursion and its applications in programming

AHL≈ 60 minCommand term: ExplainPremium

In this lesson

  • Explaining recursion, the base case and the recursive case
  • Explaining how the call stack stores recursive calls, and why stack overflow happens
  • Describing problems that suit recursion, including quicksort, binary trees and fractals
  • Describing the advantages and limitations of recursion

This lesson is part of Premium

Every topic has one free lesson. Premium unlocks every interactive lesson, the exam-style questions at the end of each one, and the rest of Praxis IB.

What's inside

  1. LearnA function that calls itself
  2. CodeRecursive factorial
  3. LabWatch the calls pile up
  4. LearnRecursion and the call stack
  5. CodeMissing the base case
  6. LabRecursion that branches
  7. LearnWhere recursion fits
  8. LearnQuicksort
  9. CodeA simple quicksort
  10. LearnAdvantages and limitations
  11. CheckQuick check
  12. ExamWorked exam answer
  13. ReviewMistakes examiners see
  14. Exam practiceExam-style questions

Ends with 4 exam-style questions worth 10 marks, with a self-marking markscheme.