Nepedia
Back to Discover
Developing Reader
🔢

Depth-first search

math Maturity 7-9 Next article →

Imagine you are in a maze.

Depth-First-Search
Depth-First-Search

You pick one path. You walk as far as you can.

If you hit a wall, you turn back. You go back to where you could have turned. This is called backtracking.

This way of searching helps you find your way. A man named Charles Trémaux used this idea. He used it to solve mazes.

Computers can use this too. They use it to look through big groups of things. It is a very smart way to explore.

84 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (6)
File:Depth-First-Search.gif
Depth-First-Search.gif
File:graph.traversal.example.svg
graph.traversal.example.svg
File:Tree edges.svg
Tree edges.svg
File:If-then-else-control-flow-graph.svg
If-then-else-control-flow-graph.svg
File:Graph.traversal.example.svg
Graph.traversal.example.svg
MAZE 30x20 DFS.ogv
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.