Hi . I have a methode in a static class which try to convert bi*nar*y tre to list
I'd like to make a recusion but I couldn't
I've implemented some opertation in my class like add,delet,find.it's too easy to implement its .
Here is the code
class ARB
{
private:
struct BT
{
int data;
BT *l;
BT *r;
};
struct BT *p;
public
ARB();
~ARB();
void del(int n);
void add(int n);
};
void ARB::del(int num)
{
//The code ,don't care about it
};
main()
{
//
BTR T;
T.add(3);
T.add(5);
};
Here is what should we do to transfert the code from Benary tree tolist
LLC ARB::changeit()
{ LLC x;
while(this!=NULL)
{
x.add(this->data); //
if(this.l==NULL)
{
x.print(); //To print the elemnts of List
return(x);
}
else
{
x=changeit(this.l);
}
if(this.r!=NULL)
{
x.~LLC();
x=changeit(this.r);
return(x);
}
}
}