Skip to content · ⁨דלג לתוכן⁩

Recursion: base case and recursive case · ⁨רקורסיה: מקרה בסיס ומקרה רקורסיבי⁩

English

A function that calls itself

  • Recursion is when a function calls itself to solve a smaller version of the same problem.
  • It needs two parts: a base case that stops, and a recursive case that shrinks the problem.
  • Without a base case, it would call itself forever and crash.
עברית

פונקציה הקוראת לעצמה

  • רקורסיה היא כאשר פונקציה קוראת לעצמה כדי לפתור גרסה קטנה יותר מאותו בעיה.
  • היא דורשת שני חלקים: מקרה בסיס שמפסיק, ומקרה רקורסיבי שמצמצם את הבעיה.
  • ללא מקרה בסיס, היא הייתה קוראת לעצמה לנצח ומתמוטטת.

Handout · ⁨חומר עזר⁩

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP