Binary tree traversing



Binary tree traversing..

Answer / 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

More C Interview Questions

What type of function is main ()?

0 Answers  


main() { float a=3.2e40; printf("%d",a); }

9 Answers   Satyam,


How can I get the current date or time of day in a c program?

0 Answers  


logic for x=y^n

1 Answers   Delphi,


how would a 4*3 array A[4][3] stored in Row Major Order?

0 Answers   HCL, Ignou,






What tq means in chat?

0 Answers  


What is meant by recursion?

0 Answers   ADP,


What is the difference b/w Structure & Union?

3 Answers  


how to generate the length of a string without using len funtion?

4 Answers  


write a C program to print the program itself ?!

16 Answers   TCS,


Explain the difference between structs and unions in c?

0 Answers  


Who is the main contributor in designing the c language after dennis ritchie?

0 Answers  


Categories