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

Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4

2 Answers   Mascot,


What is include directive in c?

0 Answers  


declare afunction pointer to int printf(char *)?

1 Answers   HCL,


How can we allocate array or structure bigger than 64kb?

2 Answers   CSC,


What is time complexity c?

0 Answers  






What is the use of typedef in c?

0 Answers  


give an example of type casting by a simple c program

2 Answers   TCS,


What is meant by inheritance?

0 Answers  


a c code by using memory allocation for add ,multiply of sprase matrixes

0 Answers  


How to declare a variable?

0 Answers  


For what purpose null pointer used?

0 Answers  


for (i <= 5 && i >= -1;++i; i > 0) { printf("%d ", i); }

1 Answers  


Categories