Hello
How do I deal with Trees as Linked Lists ??
View Photos,
Uploaded with ImageShack.us
I think I would need for TL* son ,TL* father, TL* brother.
I used to enter data this way,Code:struct ff { int id; ff * son; ff * father; ff * brother; }; class formula_s { public: ~formula_s(); formula_s(); void add_formula(ff *p1); };
I want to create a function >>> void add_formula(ff *p1);Code:f = new formula; f->id = 1; g = new formula; g->id = 11; f->son = g; g->father = f; p = new formula; p->id = 12; g->brother = p; p->father = g; p->brother = NULL; q = new formula; q->id = 13; p->son = q; q->father = p; p = new formula; p->id = 14; q->brother = p; p->father = q; p->brother = NULL; p = new formula; p->id = 15; g->son = p; p->father = g; p->brother = NULL;
so as to the user can enter data.





Reply With Quote