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

Why ca not I do something like this?

583


What is the difference between far and near in c?

596


find the sum of two matrices and WAP for it.

626


What does %2f mean in c?

672


Who developed c language?

635






What are the standard predefined macros?

627


What is difference between Structure and Unions?

634


Is struct oop?

575


What is structure in c explain with example?

629


Wt are the Buses in C Language

2746


Explain how can I open a file so that other programs can update it at the same time?

586


Differentiate between a structure and a union.

756


Here is a good puzzle: how do you write a program which produces its own source code as output?

591


What are the modifiers available in c programming language?

728


What is union and structure in c?

606