Posts

Showing posts with the label Trees

Implementing a Binary Search Tree Using C

/*This is a programme to implement a binary search tree*/ #include<stdio.h> #include<stdlib.h> typedef struct treeNode {         int data;         struct treeNode *left;         struct treeNode *right; }treeNode; treeNode* FindMin(treeNode *node) {         if(node==NULL)         {                 /* There is no element in the tree */                 return NULL;         }         if(node->left) /* Go to the left sub tree to find the min element */                 return FindMin(node->left);         else                 return node; } treeNode* FindMax(treeNode *node) {         if(node==NULL)     ...