An expression tree........
given: a/b + (c -d)c
what data members would the nodes contain? i'm a little lost. one node would contain a sign but it's direct children may contain a number or another sign, but it is unecessary to contain both.Code:+ /\ / \ '/' \ /\ \ a b * / \ / c - / \ c d
struct node
{
char sign; //is this where i would use a union?
int value; //...or am i way of completely?
node *parent;
node *son; //son = child on "left" (conceptually)
node *daughter; //daughter child on "right"
}



LinkBack URL
About LinkBacks


