hi!!
I am looking for a way to print a binary tree as a binary tree,with a root and nodes.so when you look at the screen you will see a binary tree not some data in line!
thanks !!!!
i am looking forward for an answer!
FOR mixOmatt!one way is as shown below,but the fuction has a logic bug!and the results are not printed as i expected!!
void viewtree(struct node *t,int x,int y)
{
if(t==NULL)return;
gotoxy(x,y);
printf("%d",t->key);
viewtree(t->left,x-4,y+1);
viewtree(t->right,x+4,y+1);
}
i am waiting for your reply!
you dig?