Hi All,
Hope you will be finding my blogs useful, atleast for me it will be after sometime. So here is one more post about the insertion in B.Tree.
Here I am assuming we have structure defined to store the information, I will be using it as Node.
Hope you will be finding my blogs useful, atleast for me it will be after sometime. So here is one more post about the insertion in B.Tree.
Here I am assuming we have structure defined to store the information, I will be using it as Node.
Node * insertElement(Node *head, char dir[],int val){Node *prev;Node *cur;Node *tempint i;temp->data = val;temp->left= NULL;temp->right = NULL;prev = NULL;cur = head;for(i = 0; i < strlen(dir) && cur != NULL; i++){prev = cur;if(dir[i] = 'l')cur = cur->left;elsecur = cur->right;}/* Check if it is not reachable position */if(cur != NULL || i != strlen(dir) ){printf("No Position find");free(temp);return head;}if(dir[i-1] ='l')prev->left = temp;elseprev->right = temp;return head;}
No comments:
Post a Comment