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

What is volatile, register definition in C

691


Wt are the Buses in C Language

2753


How to get string length of given string in c?

609


How can a number be converted to a string?

607


What is the significance of scope resolution operator?

863






plz let me know how to become a telecom protocol tester. thank you.

1742


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

645


How can you tell whether a program was compiled using c versus c++?

619


How can I ensure that integer arithmetic doesnt overflow?

608


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

671


How can I get back to the interactive keyboard if stdin is redirected?

670


what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

1430


List the difference between a "copy constructor" and a "assignment operator"?

583


What are global variables and how do you declare them?

621


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2055