DEV Community

Discussion on: Explain Recursion Like I'm Five

Collapse
 
rapidnerd profile image
George • Edited

Imagine you go to open a room, but the room is locked. You have someone come up to you with a box and they tell you that the key to the room is in there. But inside the box is many other boxes, that also contain boxes and you don't know which box contains the key. So you need an algorithm to find the key!
Image found online of a recursive algorithm