Posts

Showing posts with the label preorder

c program to find Binary Tree operations

Image
 Program #include <stdio.h> #include <stdlib.h>  struct tnode {         int data;         struct tnode *left, *right;   }; struct tnode *root = NULL;   struct tnode * createNode(int data)  {         struct tnode *newNode;         newNode  = (struct tnode *) malloc(sizeof(struct tnode));         newNode->data = data;         newNode->left = NULL;         newNode->right = NULL;         return (newNode);   }   void insertion(struct tnode **node, int data)  {         if (!*node)                  *node = createNode(data);          else if (data < (*node)->data)                  insertion(&(*node)->left, data);     ...