Hello
How do I deal with Trees as Linked Lists ??
View Photos,
[IMG]http://img832.imageshack.us/img832/4553/49362381.png[/IMG]
Uploaded with ImageShack.us
I think I would need for TL* son ,TL* father, TL* brother.
struct ff
{
int id;
ff * son;
ff * father;
ff * brother;
};
class formula_s
{
public:
~formula_s();
formula_s();
void add_formula(ff *p1);
};
I used to enter data this way,
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;
I want to create a function >>> void add_formula(ff *p1);
so as to the user can enter data.