Below is a binary tree with elements:
The tree, 'Tree' and its node 'Node' are represented as:
struct Node {
std::string key;
Node* left;
Node* right;
Node(std::string& k)
:key(k),left(NULL),right(NULL) {}
};
struct Tree {
Tree():root(NULL){}
void traversal(Node* n);
// .... more methods......
Node* root;
};
Below is the implementation of the traversal function:
void Tree::traversal(Node* n)
{
if(n != NULL)
{
Postorder(Root->left);
Postorder(Root->right);
std::cout << Root->key << " ";
}
}
What is the output of this code?