TreesLesson 26Free preview
DSA In-order Traversal
This lesson is part of DSA · All levels
Summary
In-order traversal visits the subtree left, node, then subtree right. In binary search trees, this sequence produces value in an upwardly sorted position, so it is very often used to print out the sorted data without re-sorting. Like other traversals, its complexity is linear to the number of nodes.
Key points
- Order of visits: left, root, right
- On the BST it produces output in ascending order
- Often used to print the contents of trees in sequence
- Complexity because each node is visited once
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.