Explore the English language on a new scale using AI-powered English language navigator.
Binary search tree. List values in order
To construct an algorithm listing BST's values in order, let us recall binary search tree property:
- left subtree of a node contains only values lesser, than the node's value;
- right subtree of a node contains only values greater, than the node's value.
- get values in order from left subtree;
- get values in order from right subtree;
- result for current node is (result for left subtree) join (current node's value) join (result for right subtree).
Example






Recommended books
- Cormen, Leiserson, Rivest. Introduction to algorithms. (Theory)
- Aho, Ullman, Hopcroft. Data Structures and Algorithms. (Theory)
- Robert Lafore. Data Structures and Algorithms in Java. (Practice)
- Mark Allen Weiss. Data Structures and Problem Solving Using C++.(Practice)

Previous: Remove operation on BST |

Contribute to AlgoList
Liked this tutorial? Please, consider making a donation. Contribute to help us keep sharing free knowledge and write new tutorials.
Every dollar helps!