Binary Tree Creation and traversal using C coding
#include<stdio.h> #include<conio.h> #include<malloc.h> typedef struct tree { int val; struct tree *lch; struct tree *rch; }tr; typedef struct stack { tr *node; struct stack *next; }st; void push(st **,tr *); tr *pop(st **); int isempty(st *); tr *createroot(); void insert(st *); void inorder(tr *); void main() { st *h=NULL; tr *ptr; clrscr(); ptr=createroot(); push(&h,ptr); insert(h); printf("\n\nInorder traversal form of the tree is : "); inorder(ptr); getch(); } tr *createroot() { int v; tr *ptr; printf("\nEnter the values : "); scanf("%d",&v); ptr=(tr *)malloc(sizeof(tr)); ptr->val=v; ptr->lch=ptr->rch=NULL; return(ptr); } void insert(st *h) { tr *ptr,*temp; char ch; int v; while(!isempty(h)) { ptr=pop(&h); printf("\n%d has left child?(y/n) : ",ptr->val); fflush(stdin); scanf("%c",&ch); if(ch=='y' || ch=='Y...