Sometimes, it helps to break a problem down.
This lets us create an algorithm to solve each simple recurring piece individually, one by one.
And to do that, we can use processes like iteration and recursion.
Iteration is when we repeat a process over and over until a stop condition is met, like running a resus until ROSC.
Recursion is when an algorithm sets off another copy of itself (often with different input) until a certain condition is met. This is like if each chest compression necessarily contained planning for the next one, and we only started the resus once we’d planned all the way to ROSC.
These two methods have very different time complexity — iteration is linear, whereas recursion is exponential.
And in a time-pressured environment like an ED, you can see how this could make all the difference.
Nonetheless, some algorithms look more simple when written recursively.
It’s a trade-off between ease and resource-effectiveness.
Sound familiar?
Here's a popular way of tackling this dilemma in computer science.