Johnder Perez

Step 6 of 6

Recursion, BFS and DFS


Recursion is a function that calls itself on a smaller piece of the problem until it hits a base case. Breadth-first search (BFS) explores a graph level by level; depth-first search (DFS) goes as deep as it can first.

Why it matters when you build with AI: Rendering nested menus, walking a file tree or finding 'shortest path' features all rely on these.

Quick check

Which explores a graph level by level?

← Previous step Finish: try the challenge →