• Graph Theory
  • Fan-out, in any tree, is number of pointers to child nodes in a node.

Operation

Tree traversal - Wikipedia

Preorder Tree Walk (前序遍历)

从根节点开始输出 - 递归到左边 - 递归到右边
输出在两个遍历前

Inorder Tree Walk (中序遍历)

从左到右扫描
从小到大输出
递归到最左边 - 输出 - 递归到右边
输出在两个遍历之间
or use an auxiliary stack Inorder Tree Traversal without Recursion - GeeksforGeeks

void printInorder(struct Node* node)
{
    if (node == NULL)
        return;
 
    /* first recur on left child */
    printInorder(node->left);
 
    /* then print the data of node */
    cout << node->data << " ";
 
    /* now recur on right child */
    printInorder(node->right);
}

Postorder Tree Walk (后序遍历)

从底到上扫描
递归到最下左边 - 输出 - 递归到下右边
Postorder traversal is used to delete the tree. Please see the question for the deletion of a tree for details. Postorder traversal is also useful to get the postfix expression of an expression tree
输出在两个遍历后