(algorithm)
Definition: Process all nodes of a tree by recursively processing all subtrees, then finally processing the root.
Also known as postfix traversal.
Generalization (I am a kind of ...)
tree traversal, depth-first search.
See also in-order traversal, preorder traversal, level-order traversal, Cupif-Giannini tree traversal.
Note:
For instance, if the "processing" is just printing, a tree is printed as "(first subtree) (second subtree) ... (last subtree) root". Here is pseudocode for a binary tree:
postorder(tree)
begin
if tree is null, return;
postorder(tree.left_subtree);
postorder(tree.right_subtree);
print(tree.root);
end
Author: PEB
If you have suggestions, corrections, or comments, please get in touch with Paul Black.
Entry modified 22 April 2019.
HTML page formatted Mon Apr 22 12:17:39 2019.
Cite this as:
Paul E. Black, "postorder traversal", in
Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 22 April 2019. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/postorderTraversal.html