• Inorder Traversal: Visit the left subtree, root, and then the right subtree.

  • Preorder Traversal: Visit the root, left subtree, and then the right subtree.

  • Postorder Traversal: Visit the left subtree, right subtree, and then the root.

    void inorder(Node* root) {
        if (!root) return;
        inorder(root->left);
        cout << root->key << " ";
        inorder(root->right);
    }