(algorithm)
Definition: Process all nodes of a tree by recursively processing the left subtree, then processing the root, and finally the right subtree.
Also known as symmetric traversal.
Generalization (I am a kind of ...)
tree traversal, depth-first search.
Aggregate parent (I am a part of or used in ...)
treesort (1).
See also postorder traversal, preorder traversal, level-order traversal, Cupif-Giannini tree traversal.
Note:
For instance, if the "processing" is just printing, a tree is printed as "(left subtree) root (right subtree)". Here is pseudocode for a binary tree:
inorder(tree)
begin
if tree is null, return;
inorder(tree.left_subtree);
print(tree.root);
inorder(tree.right_subtree);
end
Author: PEB
If you have suggestions, corrections, or comments, please get in touch with Paul Black.
Entry modified 3 May 2019.
HTML page formatted Fri May 3 16:28:23 2019.
Cite this as:
Paul E. Black, "in-order traversal", in
Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 3 May 2019. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/inorderTraversal.html