Showing posts with label preorder. Show all posts
Showing posts with label preorder. Show all posts

Saturday, May 18, 2013

Binary Tree Implementation in C with Tree Traversals

We can implement the binary tree using C so that we can add a node, delete a node, and can perform different tree traversals:
 1. Preorder tree traversal
 2. Inorder tree traversal
 3. Post order tree traversal




/// ..............................................BINARY TREE OPERATIONS AND TREE TRAVERSALS

#include<stdio.h>
#include<conio.h>
#include<malloc.h>

///.................................................................DYNAMIC STRUCTURE FOR BINARY TREE

struct tree
{
     int info;
     struct tree *left_subtree;
     struct tree *right_subtree;
};