Posts

Showing posts from November, 2017

The K-ary Tree Concept

The k-ary Tree ·               The K-ary tree is theory derived from Graph theories.         Also sometimes referred as a k-way tree , an N-ary tree, or an M-ary tree. Program Implementation of K-ary Tree where k=3 Using structure As Pointers has been given (implemented in C): #include<stdio.h> #include<conio.h> struct NODE {     char* word;     int depth, children;     struct node **child }; typedef struct NODE node; node *createTree(); node *createNode(char* w, int d); int main() {     node *root, *pos;     root=createNode("root",0);  //Height of the Root node is initially set as Zero     pos=root;   //Current navigation position of the tree is at the root.     printf("root has been created with word: %s \n",pos->word);     char *array[]={"String1","String2","String3"};     int i;     pos->child = malloc(3 * sizeof(node *));     for (i=1;i<=3;i++)