AI engineering glossary · Data structures algorithms

What is tree traversal?

Tree traversal (also called inorder traversal, preorder, postorder): A systematic way of visiting every node of a tree exactly once. Common orders are preorder (node, left, right), inorder (left, node, right), postorder (left, right, node) and level order (row by row). Inorder on a search tree yields keys in sorted order.

Level: intermediateTopic: Data structures algorithms

Tree traversal: an example

Inorder traversal of a binary search tree holding 30, 10, 50 and 20 prints 10, 20, 30, 50.

Related terms

More Data structures algorithms terms

Where you learn it

Tree traversal is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.