Binary tree traversing

Answer Posted / qint

void Traverse(Node *t)
{
if(NULL == t)
return;

//in-order traversing
Traverse(t->left);
printf("%d",t->data);
Traverse(t->right);

//pre-order
printf("%d",t->data);
Traverse(t->left);
Traverse(t->right);

//post order
Traverse(t->left);
Traverse(t->right);
printf("%d",t->data);
}

Is This Answer Correct ?    13 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is Exception handling possible in c language?

1805


Why we use conio h in c?

903


What are the functions to open and close file in c language?

961


What does dm mean sexually?

1051


What are run-time errors?

834


what do u mean by Direct access files? then can u explain about Direct Access Files?

1851


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1144


What is pragma c?

861


What is a structure in c language. how to initialise a structure in c?

848


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

948


What are the back slash character constants or escape sequence charactersavailable in c?

946


List the variables are used for writing doubly linked list program.

1822


How many types of sorting are there in c?

828


What is the difference between array and pointer?

786


What is array of pointers to string?

807