Skip to interview prep
Apexed

15. What is recursion, and what are its risks?

EasyProgramming fundamentals

Technical
Show model answer

A recursive function calls itself on a smaller input until it reaches a base case. It fits naturally recursive structures such as trees and divide-and-conquer algorithms.

Risks: missing or wrong base cases cause infinite recursion, deep inputs can overflow the call stack, and naive recursion can repeat work (fixed with memoisation or an iterative version).

What is recursion, and what are its risks — Software engineering interview question — Apexed