I have a 2-3 tree with the following node structure:
struct node
{
int value1, value2;
node *parent, *left, *right, *middle;
}
The problem is I don't know how to parse the whole tree. I know how we search for it because you simply go to the right path. But how to I get to check all the nodes in the tree?
Here is pseudocode, that might help:
void ParseNode(node *n)
{
OperationToParseCurrentNode();
if(n->left)
ParseNode(n->left);
if(n->middle)
ParseNode(n->middle);
if(n->right)
ParseNode(n->right);
}
This will traverse all nodes if you input the root node.