http://codeworldtechnology.wordpress.com/2009/05/17/program-to-m...
Home > C Examples > PROGRAM TO MAKE A BINARY SEARCH TREE AND TRAVERSE IT IN PREORDER,INORDER,POSTORDER METHOD.
//PUT
//PREORDER TRAVERSAL
//INORDER TRAVERSAL
void postorder(tree *node) //POST ORDER TRAVERSAL { if(node->left!=NULL) postorder(node->left); if(node->right!=NULL) postorder(node->right); cout<<" "<<node->data; } void main() //EXECUTION STARTS HERE { tree *garb,*root=NULL; getdata(); temp=head; cout<<"n DUPLICATE ELEMENTS ARE : n"; while(temp!=NULL) { garb=new tree; makenode(&garb,temp->num); maketree(garb,&root); temp=temp->next; } cout<<"n PREORDER TRAVERSE :"; preorder(root); cout<<"n INORDER TRAVERSE :"; inorder(root); cout<<"n POSTORDER TRAVERSE :"; postorder(root); free(garb); free(root); cout<<"n"; }
About these ads
First Name
Last Name
Categories: C Examples Tags: binary search tree, Inorder, postorder, preorder, tree Comments (2) Trackbacks (0) Leave a comment Trackback
1 of 2
12/24/2012 5:36 PM
http://codeworldtechnology.wordpress.com/2009/05/17/program-to-m...
1. JaneRadriges 13/06/2009 at 11:52 PM | #1 Reply | Quote Hi, interest post. Ill write you later about few questions! 2. KattyBlackyard 15/06/2009 at 5:46 AM | #2 Reply | Quote The best information i have found exactly here. Keep going Thank you 1. No trackbacks yet.
Leave a Reply
TEXT EDITOR USING A DOUBLY LINKED LIST. PROGRAM TO MAKE AN EXPRESSION TREE. RSS feed
Recent Posts
Example of Generic class with two type parameters. A simple Generics example. Scanner to read various types of data from a file. Scanner to read double numbers from a file and display their average. Scanner to read double numbers from keyboard and display their average. Demonstrates The overloading Varargs methods. Demonstrates the VARARGS feature of java for variable arguments along with normal parameters. Demonstrates the VARARGS feature of java for variable arguments. Variable length argument implemented using array. Demonstrates the PRECISION modifier in Formatter Class.
Categories
C Examples (139) Java (76) Knowledge and Fun (11) Linux (1) Programming (1) Scripting (16) javascripts (5) orkut userscripts (5) perl hacks (8) shell hacks (3) Uncategorized (11) useful PHP scripts (3)
Archives
June 2010 (15) January 2010 (28) November 2009 (17) October 2009 (1) September 2009 (35) August 2009 (18) July 2009 (42) June 2009 (68) May 2009 (30)
Login
Register Log in Entries RSS Comments RSS WordPress.com
Tags
array BINARY SEARCH binary search tree Binary tree BUBBLE SORT C++
program push Recursion scanner searching sorting stack string
file handling find substring Formatter class Function functions greasemonkey insertion INSERTION SORT
largest number
linked list lower case matrix Multiplication orkut perl pointers pop
Recent Comments
Ritu on Program to insert a substring amar on Progrma to deal with complex n Think2day on Program to calculate sum of ge Tenpyhottenew on Program to implement time dela hooveanuche on Program to implement time dela Twithreubrete on Program to implement time dela euroritom on Program to implement time dela Wordpress Themes on Program to find minimum and ma seiliPriepe on Program to implement time dela Pneubcure on Program to implement time dela Top WordPress Blog at WordPress.com. Theme: INove by NeoEase.
2 of 2
12/24/2012 5:36 PM