Define how recursion works

Recusion works by creating a method which is defined in terms of itself. This effectively means that the method will make method calls to itself. It makes these calls using increasingly reduced problem sizes as arguments, until a base case is reached. These method calls are stored in a stack, and when the base case is reached, the stack is evaluated, as they are, in a last-in-first-out order, leading to a final result.

MK

Related Computing IB answers

All answers ▸

What is data validation and data verification?


How do you convert a number between decimal and binary?


Define the terms CU and ALU and briefly explain their roles in the CPU.


Add the binary numbers 100101 and 101001 and convert them to decimal (they are unsigned integers). What are possible issues when adding the numbers?