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

Explain the properties of union. What is the size of a union variable

0 Answers  


what is the Output? int a=4 b=3; printf("%d%d%d%d%d%d",a++,++a,a++,a++,++a,a++); printf("%d%d%d%d%d%d",b--,b--,--b,b--,--b,--b);

10 Answers   IBM,


Find if a number is power of two or not?

1 Answers  


Subtract Two Number Without Using Subtraction Operator

0 Answers  


Why is the code below functioning. According to me it MUST NOT.

1 Answers  


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

0 Answers   Amdocs, Apps Associates,


Explain goto?

0 Answers  


What are categories used for in c?

0 Answers  


How many levels of pointers can you have?

0 Answers  


Explain 'far' and 'near' pointers in c.

0 Answers  


What is the purpose of the code, and is there any problem with it? unsigned int f( unsigned n ) { return –n & 7; }

1 Answers   Google,


What does char * * argv mean in c?

0 Answers  


Categories