From 44ddbf3c4c50fbd8cebbafc0ec04097060b97002 Mon Sep 17 00:00:00 2001 From: yyash01 Date: Mon, 8 Jun 2020 01:34:58 +0530 Subject: [PATCH 01/10] improved library --- sorting/binary_Insertion_Sort.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sorting/binary_Insertion_Sort.c b/sorting/binary_Insertion_Sort.c index 4c3f2dd2..fb91a746 100644 --- a/sorting/binary_Insertion_Sort.c +++ b/sorting/binary_Insertion_Sort.c @@ -2,11 +2,13 @@ * Using binary search to find the proper location for * inserting the selected item at each iteration. */ #include +#include +//nothing to add on library /*Displays the array, passed to this method*/ void display(int arr[], int n) { int i; - for(i = 0; i < n; i++){ + for (i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); @@ -14,9 +16,9 @@ void display(int arr[], int n) { int binarySearch(int arr[], int key, int low, int high) { if (low >= high) - return (key > arr[low]) ? (low + 1): low; + return (key > arr[low]) ? (low + 1) : low; int mid = low + (high - 1) / 2; - if(arr[mid] == key) + if (arr[mid] == key) return mid + 1; else if (arr[mid] > key) return binarySearch(arr, key, low, mid - 1); @@ -30,14 +32,14 @@ int binarySearch(int arr[], int key, int low, int high) { */ void insertionSort(int arr[], int size) { int i, j, key, index; - for(i = 0; i < size; i++) { + for (i = 0; i < size; i++) { j = i - 1; key = arr[i]; /* Use binrary search to find exact key's index */ index = binarySearch(arr, key, 0, j); /* Move all elements greater than key from [index...j] * to one position */ - while(j >= index) { + while (j >= index) { arr[j + 1] = arr[j]; j = j - 1; } @@ -54,7 +56,7 @@ int main(int argc, const char * argv[]) { printf("Enter the elements of the array\n"); int i; int arr[n]; - for(i = 0; i < n; i++) { + for (i = 0; i < n; i++) { scanf("%d", &arr[i] ); } From 9a82905aa509504e1eef31faefcb11c8904bd235 Mon Sep 17 00:00:00 2001 From: Sombit Bose Date: Mon, 8 Jun 2020 22:36:04 +0530 Subject: [PATCH 02/10] Revert "improved library" --- sorting/binary_Insertion_Sort.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sorting/binary_Insertion_Sort.c b/sorting/binary_Insertion_Sort.c index fb91a746..4c3f2dd2 100644 --- a/sorting/binary_Insertion_Sort.c +++ b/sorting/binary_Insertion_Sort.c @@ -2,13 +2,11 @@ * Using binary search to find the proper location for * inserting the selected item at each iteration. */ #include -#include -//nothing to add on library /*Displays the array, passed to this method*/ void display(int arr[], int n) { int i; - for (i = 0; i < n; i++) { + for(i = 0; i < n; i++){ printf("%d ", arr[i]); } printf("\n"); @@ -16,9 +14,9 @@ void display(int arr[], int n) { int binarySearch(int arr[], int key, int low, int high) { if (low >= high) - return (key > arr[low]) ? (low + 1) : low; + return (key > arr[low]) ? (low + 1): low; int mid = low + (high - 1) / 2; - if (arr[mid] == key) + if(arr[mid] == key) return mid + 1; else if (arr[mid] > key) return binarySearch(arr, key, low, mid - 1); @@ -32,14 +30,14 @@ int binarySearch(int arr[], int key, int low, int high) { */ void insertionSort(int arr[], int size) { int i, j, key, index; - for (i = 0; i < size; i++) { + for(i = 0; i < size; i++) { j = i - 1; key = arr[i]; /* Use binrary search to find exact key's index */ index = binarySearch(arr, key, 0, j); /* Move all elements greater than key from [index...j] * to one position */ - while (j >= index) { + while(j >= index) { arr[j + 1] = arr[j]; j = j - 1; } @@ -56,7 +54,7 @@ int main(int argc, const char * argv[]) { printf("Enter the elements of the array\n"); int i; int arr[n]; - for (i = 0; i < n; i++) { + for(i = 0; i < n; i++) { scanf("%d", &arr[i] ); } From 93e1bfc1f98824a97ee49ca97f2f30642ba86b99 Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 14:23:07 +0530 Subject: [PATCH 03/10] added threaded binary tree --- .../binary_trees/Threaded_Binary_Tree.c | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 data_structures/binary_trees/Threaded_Binary_Tree.c diff --git a/data_structures/binary_trees/Threaded_Binary_Tree.c b/data_structures/binary_trees/Threaded_Binary_Tree.c new file mode 100644 index 00000000..2804c36b --- /dev/null +++ b/data_structures/binary_trees/Threaded_Binary_Tree.c @@ -0,0 +1,260 @@ +#include +#include + +/*Threaded Binary Tree is a binary tree variant in which all left child +pointers that are NULL (in Linked list representation) point to its +in-order predecessor, and all right child pointers that are NULL +(in Linked list representation) point to its in-order successor. + +This file is a simple implementation of a Threaded Binary Tree +with the following functionalities: + - Insertion + - Search + - Deletion + - Listing of node keys inorder,preorder, postorder +*/ + +// Node, the basic data structure in the tree +typedef struct Node +{ + int data; + struct Node *llink; + struct Node *rlink; +}node; + +node* create_node(int data) +{ + node *ptr=(node*) malloc(sizeof(node)); + ptr->rlink=ptr->llink=NULL; + ptr->data=data; + return ptr; +} + +void insert_BT(node **root,int data) +{ + node *new_node=create_node(data); + node *temp; //to be deleted + node *prev; //keeps track of the parent of the element deleted + if(*root==NULL) + { + *root=new_node; + } + else + { + temp=*root; + prev=NULL; + while(temp!=NULL) + { + if(new_node->data>temp->data) + { + prev=temp; + temp=temp->rlink; + } + else if(new_node->datadata) + { + prev=temp; + temp=temp->llink; + } + else + { + return; + } + } + + if(new_node->data>prev->data) + { + prev->rlink=new_node; + } + else + { + prev->llink=new_node; + } + } +} + +// returns "Element found" if the search element is present else returns, "Element not found" +void search(node *root, int ele) +{ + node *temp=root; + while(temp!=NULL) + { + if(temp->data==ele) + { + break; + } + else if(ele>temp->data) + { + temp=temp->rlink; + } + else + { + temp=temp->llink; + } + } + + if(temp==NULL) + { + printf("%s\n","Element not found." ); + } + else printf("%s\n","Element found." ); +} + +void inorder_display(node *curr) +{ + if(curr!=NULL) + { + inorder_display(curr->llink); + printf("%d\t",curr->data ); + inorder_display(curr->rlink); + } + +} + +void postorder_BT(node *curr) +{ + if(curr!=NULL) + { + postorder_BT(curr->llink); + postorder_BT(curr->rlink); + printf("%d\t",curr->data); + } + +} + +void preorder_BT(node *curr) +{ + if(curr!=NULL) + { + printf("%d\t",curr->data); + preorder_BT(curr->llink); + preorder_BT(curr->rlink); + } +} + +// deletes the node if present, else it takes no action. +void delete_BT(node **root,int ele) +{ + node* temp; + node *prev; + if(*root==NULL) return; + else + { + temp=*root; + prev=NULL; + // search + while(temp!=NULL) + { + if(temp->data==ele) + { + break; + } + else if(ele>temp->data) + { + prev=temp; + temp=temp->rlink; + } + else + { + prev=temp; + temp=temp->llink; + } + } + } + + if(temp==NULL) + return; + else + { + node *replacement; //deleted node's replacement + node *t; + if(temp->llink==NULL && temp->rlink==NULL) + { + replacement=NULL; + } + else if(temp->llink==NULL && temp->rlink!=NULL) + { + replacement=temp->rlink; + } + else if(temp->llink!=NULL && temp->rlink==NULL) + { + replacement=temp->llink; + } + else + { + replacement=temp->rlink; //replaced with inorder successor + t=replacement; + while(t->llink!=NULL) + { + t=t->llink; + } + t->llink=temp->llink; //leftmost node of the replacement is linked to the left child of the deleted node + } + + if(temp==*root) + { + free(*root); + *root=replacement; + } + else if(prev->llink==temp) + { + free(prev->llink); + prev->llink=replacement; + } + else if(prev->rlink==temp) + { + free(prev->rlink); + prev->rlink=replacement; + } + } + } + + +void main() +{ + printf("BINARY TREE: \n"); + node *root=NULL; + int choice,n; + do + { + printf("%s\n","1. Insert into BT" ); + printf("%s\n","2. Print BT - inorder" ); + printf("%s\n","3. Print BT - preorder" ); + printf("%s\n","4. print BT - postorder" ); + printf("%s\n","5. delete from BT" ); + printf("%s\n","6. search in BT" ); + scanf("%d",&choice); + + + switch(choice) + { + case 1: + printf("%s\n","Enter a no:" ); + scanf("%d",&n); + insert_BT(&root,n); + break; + case 2: + inorder_display(root); + printf("\n"); + break; + case 3: + preorder_BT(root); + printf("\n"); + break; + case 4: + postorder_BT(root); + printf("\n"); + break; + case 5: + printf("%s\n","Enter a no:" ); + scanf("%d",&n); + delete_BT(&root,n); + break; + case 6: + printf("%s\n","Enter a no:" ); + scanf("%d",&n); + search(root,n); + break; + } + + }while(choice!=0); +} From e63c806f25ee217b2628ff172a92c4eb9de683d2 Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 19:35:59 +0530 Subject: [PATCH 04/10] updated documentation and format --- .../binary_trees/Threaded_Binary_Tree.c | 462 +++++++++--------- 1 file changed, 222 insertions(+), 240 deletions(-) diff --git a/data_structures/binary_trees/Threaded_Binary_Tree.c b/data_structures/binary_trees/Threaded_Binary_Tree.c index 2804c36b..1be03183 100644 --- a/data_structures/binary_trees/Threaded_Binary_Tree.c +++ b/data_structures/binary_trees/Threaded_Binary_Tree.c @@ -1,260 +1,242 @@ -#include -#include +/** + * @file + * \brief Threaded Binary Tree is a binary tree variant in which all left child + * pointers that are NULL (in Linked list representation) point to its + * in-order predecessor, and all right child pointers that are NULL + * (in Linked list representation) point to its in-order successor. + * This file is a simple implementation of a Threaded Binary Tree + * with the following functionalities: + * - Insertion + * - Search + * - Deletion + * - Listing of node keys inorder,preorder,postorder + * \author [Amitha Nayak](https://github.com/amitnayakblr) + */ -/*Threaded Binary Tree is a binary tree variant in which all left child -pointers that are NULL (in Linked list representation) point to its -in-order predecessor, and all right child pointers that are NULL -(in Linked list representation) point to its in-order successor. +#include +#include -This file is a simple implementation of a Threaded Binary Tree -with the following functionalities: - - Insertion - - Search - - Deletion - - Listing of node keys inorder,preorder, postorder -*/ +/** + * Node, the basic data structure of the tree + **/ +typedef struct Node { + int data; /**< stores the number */ + struct Node *llink; /**< link to left child */ + struct Node *rlink; /**< link to right child */ +} node; -// Node, the basic data structure in the tree -typedef struct Node -{ - int data; - struct Node *llink; - struct Node *rlink; -}node; - -node* create_node(int data) -{ - node *ptr=(node*) malloc(sizeof(node)); - ptr->rlink=ptr->llink=NULL; - ptr->data=data; - return ptr; +/** + * creates a new node + * param[in] data value to be inserted + * \returns a pointer to the new node + **/ +node *create_node(int data) { + node *ptr = (node *)malloc(sizeof(node)); + ptr->rlink = ptr->llink = NULL; + ptr->data = data; + return ptr; } -void insert_BT(node **root,int data) -{ - node *new_node=create_node(data); - node *temp; //to be deleted - node *prev; //keeps track of the parent of the element deleted - if(*root==NULL) - { - *root=new_node; - } - else - { - temp=*root; - prev=NULL; - while(temp!=NULL) - { - if(new_node->data>temp->data) - { - prev=temp; - temp=temp->rlink; - } - else if(new_node->datadata) - { - prev=temp; - temp=temp->llink; - } - else - { - return; - } - } +/** + * inserts a node into the tree + * param[in,out] root pointer to node pointer to the topmost node of the tree + * param[in] data value to be inserted into the tree + */ +void insert_BT(node **root, int data) { + node *new_node = create_node(data); + node *temp; // to be deleted + node *prev; // keeps track of the parent of the element deleted + if (*root == NULL) { + *root = new_node; + } else { + temp = *root; + prev = NULL; + while (temp != NULL) { + if (new_node->data > temp->data) { + prev = temp; + temp = temp->rlink; + } else if (new_node->data < temp->data) { + prev = temp; + temp = temp->llink; + } else { + return; + } + } - if(new_node->data>prev->data) - { - prev->rlink=new_node; - } - else - { - prev->llink=new_node; - } - } + if (new_node->data > prev->data) { + prev->rlink = new_node; + } else { + prev->llink = new_node; + } + } } -// returns "Element found" if the search element is present else returns, "Element not found" -void search(node *root, int ele) -{ - node *temp=root; - while(temp!=NULL) - { - if(temp->data==ele) - { - break; - } - else if(ele>temp->data) - { - temp=temp->rlink; - } - else - { - temp=temp->llink; - } - } +/** + * searches for the element + * \param[in] root node pointer to the topmost node of the tree + * \param[in] ele value searched for + */ +void search(node *root, int ele) { + node *temp = root; + while (temp != NULL) { + if (temp->data == ele) { + break; + } else if (ele > temp->data) { + temp = temp->rlink; + } else { + temp = temp->llink; + } + } - if(temp==NULL) - { - printf("%s\n","Element not found." ); - } - else printf("%s\n","Element found." ); + if (temp == NULL) { + printf("%s\n", "Element not found."); + } else + printf("%s\n", "Element found."); } -void inorder_display(node *curr) -{ - if(curr!=NULL) - { - inorder_display(curr->llink); - printf("%d\t",curr->data ); - inorder_display(curr->rlink); - } - +/* + * performs inorder traversal + * param[in] curr node pointer to the topmost node of the tree + */ +void inorder_display(node *curr) { + if (curr != NULL) { + inorder_display(curr->llink); + printf("%d\t", curr->data); + inorder_display(curr->rlink); + } } -void postorder_BT(node *curr) -{ - if(curr!=NULL) - { - postorder_BT(curr->llink); - postorder_BT(curr->rlink); - printf("%d\t",curr->data); - } - +/* + * performs postorder traversal + * param[in] curr node pointer to the topmost node of the tree + */ +void postorder_BT(node *curr) { + if (curr != NULL) { + postorder_BT(curr->llink); + postorder_BT(curr->rlink); + printf("%d\t", curr->data); + } } -void preorder_BT(node *curr) -{ - if(curr!=NULL) - { - printf("%d\t",curr->data); - preorder_BT(curr->llink); - preorder_BT(curr->rlink); - } +/* + * performs preorder traversal + * param[in] curr node pointer to the topmost node of the tree + */ +void preorder_BT(node *curr) { + if (curr != NULL) { + printf("%d\t", curr->data); + preorder_BT(curr->llink); + preorder_BT(curr->rlink); + } } -// deletes the node if present, else it takes no action. -void delete_BT(node **root,int ele) -{ - node* temp; - node *prev; - if(*root==NULL) return; - else - { - temp=*root; - prev=NULL; - // search - while(temp!=NULL) - { - if(temp->data==ele) - { - break; - } - else if(ele>temp->data) - { - prev=temp; - temp=temp->rlink; - } - else - { - prev=temp; - temp=temp->llink; - } - } - } +/* + * deletion of a node from the tree + * if the node isn't present in the tree, it takes no action. + * param[in,out] root pointer to node pointer to the topmost node of the tree + * param[in] ele value to be deleted from the tree + */ +void delete_BT(node **root, int ele) { + node *temp; + node *prev; + if (*root == NULL) + return; + else { + temp = *root; + prev = NULL; + // search + while (temp != NULL) { + if (temp->data == ele) { + break; + } else if (ele > temp->data) { + prev = temp; + temp = temp->rlink; + } else { + prev = temp; + temp = temp->llink; + } + } + } - if(temp==NULL) - return; - else - { - node *replacement; //deleted node's replacement - node *t; - if(temp->llink==NULL && temp->rlink==NULL) - { - replacement=NULL; - } - else if(temp->llink==NULL && temp->rlink!=NULL) - { - replacement=temp->rlink; - } - else if(temp->llink!=NULL && temp->rlink==NULL) - { - replacement=temp->llink; - } - else - { - replacement=temp->rlink; //replaced with inorder successor - t=replacement; - while(t->llink!=NULL) - { - t=t->llink; - } - t->llink=temp->llink; //leftmost node of the replacement is linked to the left child of the deleted node - } + if (temp == NULL) + return; + else { + node *replacement; // deleted node's replacement + node *t; + if (temp->llink == NULL && temp->rlink == NULL) { + replacement = NULL; + } else if (temp->llink == NULL && temp->rlink != NULL) { + replacement = temp->rlink; + } else if (temp->llink != NULL && temp->rlink == NULL) { + replacement = temp->llink; + } else { + replacement = temp->rlink; // replaced with inorder successor + t = replacement; + while (t->llink != NULL) { + t = t->llink; + } + t->llink = temp->llink; // leftmost node of the replacement is linked to + // the left child of the deleted node + } - if(temp==*root) - { - free(*root); - *root=replacement; - } - else if(prev->llink==temp) - { - free(prev->llink); - prev->llink=replacement; - } - else if(prev->rlink==temp) - { - free(prev->rlink); - prev->rlink=replacement; - } - } - } - - -void main() -{ - printf("BINARY TREE: \n"); - node *root=NULL; - int choice,n; - do - { - printf("%s\n","1. Insert into BT" ); - printf("%s\n","2. Print BT - inorder" ); - printf("%s\n","3. Print BT - preorder" ); - printf("%s\n","4. print BT - postorder" ); - printf("%s\n","5. delete from BT" ); - printf("%s\n","6. search in BT" ); - scanf("%d",&choice); - - - switch(choice) - { - case 1: - printf("%s\n","Enter a no:" ); - scanf("%d",&n); - insert_BT(&root,n); - break; - case 2: - inorder_display(root); - printf("\n"); - break; - case 3: - preorder_BT(root); - printf("\n"); - break; - case 4: - postorder_BT(root); - printf("\n"); - break; - case 5: - printf("%s\n","Enter a no:" ); - scanf("%d",&n); - delete_BT(&root,n); - break; - case 6: - printf("%s\n","Enter a no:" ); - scanf("%d",&n); - search(root,n); - break; - } - - }while(choice!=0); + if (temp == *root) { + free(*root); + *root = replacement; + } else if (prev->llink == temp) { + free(prev->llink); + prev->llink = replacement; + } else if (prev->rlink == temp) { + free(prev->rlink); + prev->rlink = replacement; + } + } +} + +/* + * main function + */ +void main() { + printf("BINARY THREADED TREE: \n"); + node *root = NULL; + int choice, n; + do { + printf("%s\n", "1. Insert into BT"); + printf("%s\n", "2. Print BT - inorder"); + printf("%s\n", "3. Print BT - preorder"); + printf("%s\n", "4. print BT - postorder"); + printf("%s\n", "5. delete from BT"); + printf("%s\n", "6. search in BT"); + printf("%s\n", "Type 0 to exit"); + scanf("%d", &choice); + + switch (choice) { + case 1: + printf("%s\n", "Enter a no:"); + scanf("%d", &n); + insert_BT(&root, n); + break; + case 2: + inorder_display(root); + printf("\n"); + break; + case 3: + preorder_BT(root); + printf("\n"); + break; + case 4: + postorder_BT(root); + printf("\n"); + break; + case 5: + printf("%s\n", "Enter a no:"); + scanf("%d", &n); + delete_BT(&root, n); + break; + case 6: + printf("%s\n", "Enter a no:"); + scanf("%d", &n); + search(root, n); + break; + } + } while (choice != 0); } From e77581f7881b3191fc608eaa8e0ec82ba5f257f6 Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 19:47:53 +0530 Subject: [PATCH 05/10] filename and functionname updated --- .../binary_trees/Threaded_Binary_Tree.c | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/data_structures/binary_trees/Threaded_Binary_Tree.c b/data_structures/binary_trees/Threaded_Binary_Tree.c index 1be03183..4f610b98 100644 --- a/data_structures/binary_trees/Threaded_Binary_Tree.c +++ b/data_structures/binary_trees/Threaded_Binary_Tree.c @@ -42,7 +42,7 @@ node *create_node(int data) { * param[in,out] root pointer to node pointer to the topmost node of the tree * param[in] data value to be inserted into the tree */ -void insert_BT(node **root, int data) { +void insert_bt(node **root, int data) { node *new_node = create_node(data); node *temp; // to be deleted node *prev; // keeps track of the parent of the element deleted @@ -94,7 +94,7 @@ void search(node *root, int ele) { printf("%s\n", "Element found."); } -/* +/** * performs inorder traversal * param[in] curr node pointer to the topmost node of the tree */ @@ -106,37 +106,37 @@ void inorder_display(node *curr) { } } -/* +/** * performs postorder traversal * param[in] curr node pointer to the topmost node of the tree */ -void postorder_BT(node *curr) { +void postorder_display(node *curr) { if (curr != NULL) { - postorder_BT(curr->llink); - postorder_BT(curr->rlink); + postorder_display(curr->llink); + postorder_display(curr->rlink); printf("%d\t", curr->data); } } -/* +/** * performs preorder traversal * param[in] curr node pointer to the topmost node of the tree */ -void preorder_BT(node *curr) { +void preorder_display(node *curr) { if (curr != NULL) { printf("%d\t", curr->data); - preorder_BT(curr->llink); - preorder_BT(curr->rlink); + preorder_display(curr->llink); + preorder_display(curr->rlink); } } -/* +/** * deletion of a node from the tree * if the node isn't present in the tree, it takes no action. * param[in,out] root pointer to node pointer to the topmost node of the tree * param[in] ele value to be deleted from the tree */ -void delete_BT(node **root, int ele) { +void delete_bt(node **root, int ele) { node *temp; node *prev; if (*root == NULL) @@ -192,10 +192,10 @@ void delete_BT(node **root, int ele) { } } -/* +/** * main function */ -void main() { +int main() { printf("BINARY THREADED TREE: \n"); node *root = NULL; int choice, n; @@ -213,24 +213,24 @@ void main() { case 1: printf("%s\n", "Enter a no:"); scanf("%d", &n); - insert_BT(&root, n); + insert_bt(&root, n); break; case 2: inorder_display(root); printf("\n"); break; case 3: - preorder_BT(root); + preorder_display(root); printf("\n"); break; case 4: - postorder_BT(root); + postorder_display(root); printf("\n"); break; case 5: printf("%s\n", "Enter a no:"); scanf("%d", &n); - delete_BT(&root, n); + delete_bt(&root, n); break; case 6: printf("%s\n", "Enter a no:"); @@ -239,4 +239,5 @@ void main() { break; } } while (choice != 0); + return 0; } From 522183b96c53f60537f4180d128a1b1f1c190ac5 Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 19:50:50 +0530 Subject: [PATCH 06/10] changed filename --- .../{Threaded_Binary_Tree.c => threaded_binary_trees.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename data_structures/binary_trees/{Threaded_Binary_Tree.c => threaded_binary_trees.c} (100%) diff --git a/data_structures/binary_trees/Threaded_Binary_Tree.c b/data_structures/binary_trees/threaded_binary_trees.c similarity index 100% rename from data_structures/binary_trees/Threaded_Binary_Tree.c rename to data_structures/binary_trees/threaded_binary_trees.c From 81d568da821a806a8714fe0886f731de0ade0ffe Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 20:04:08 +0530 Subject: [PATCH 07/10] changed brief --- data_structures/binary_trees/threaded_binary_trees.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/data_structures/binary_trees/threaded_binary_trees.c b/data_structures/binary_trees/threaded_binary_trees.c index 4f610b98..1f62788d 100644 --- a/data_structures/binary_trees/threaded_binary_trees.c +++ b/data_structures/binary_trees/threaded_binary_trees.c @@ -1,15 +1,13 @@ /** * @file - * \brief Threaded Binary Tree is a binary tree variant in which all left child - * pointers that are NULL (in Linked list representation) point to its - * in-order predecessor, and all right child pointers that are NULL - * (in Linked list representation) point to its in-order successor. - * This file is a simple implementation of a Threaded Binary Tree - * with the following functionalities: + * \brief This file is a simple implementation of a Threaded Binary Tree + * + * It has the following functionalities: * - Insertion * - Search * - Deletion * - Listing of node keys inorder,preorder,postorder + * * \author [Amitha Nayak](https://github.com/amitnayakblr) */ From cf4e3207266661770ac313e785c04b2024a6957b Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 20:13:45 +0530 Subject: [PATCH 08/10] added details --- data_structures/binary_trees/threaded_binary_trees.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data_structures/binary_trees/threaded_binary_trees.c b/data_structures/binary_trees/threaded_binary_trees.c index 1f62788d..9213ba5a 100644 --- a/data_structures/binary_trees/threaded_binary_trees.c +++ b/data_structures/binary_trees/threaded_binary_trees.c @@ -2,12 +2,16 @@ * @file * \brief This file is a simple implementation of a Threaded Binary Tree * + * Threaded Binary Tree is a binary tree variant in which all left child + * pointers that are NULL (in Linked list representation) point to its + * in-order predecessor, and all right child pointers that are NULL + * (in Linked list representation) point to its in-order successor. * It has the following functionalities: * - Insertion * - Search * - Deletion * - Listing of node keys inorder,preorder,postorder - * + * \author [Amitha Nayak](https://github.com/amitnayakblr) */ From 590173ec8187e02ed30fe5776fec5b6d96596714 Mon Sep 17 00:00:00 2001 From: Amit Date: Thu, 11 Jun 2020 20:17:13 +0530 Subject: [PATCH 09/10] added ref --- data_structures/binary_trees/threaded_binary_trees.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data_structures/binary_trees/threaded_binary_trees.c b/data_structures/binary_trees/threaded_binary_trees.c index 9213ba5a..49accb08 100644 --- a/data_structures/binary_trees/threaded_binary_trees.c +++ b/data_structures/binary_trees/threaded_binary_trees.c @@ -11,7 +11,9 @@ * - Search * - Deletion * - Listing of node keys inorder,preorder,postorder - + * + * -see binary_search_tree.c + * * \author [Amitha Nayak](https://github.com/amitnayakblr) */ From 7c815b86b20ddc07ee1f33753f370baf63cc48aa Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 11 Jun 2020 15:26:23 +0000 Subject: [PATCH 10/10] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 574b49b0..ecea9a2c 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -38,6 +38,7 @@ * [Create Node](https://github.com/TheAlgorithms/C/blob/master/data_structures/binary_trees/create_node.c) * [Recursive Traversals](https://github.com/TheAlgorithms/C/blob/master/data_structures/binary_trees/recursive_traversals.c) * [Redblacktree](https://github.com/TheAlgorithms/C/blob/master/data_structures/binary_trees/redBlackTree.c) + * [Threaded Binary Trees](https://github.com/TheAlgorithms/C/blob/master/data_structures/binary_trees/threaded_binary_trees.c) * Dictionary * [Dict](https://github.com/TheAlgorithms/C/blob/master/data_structures/dictionary/dict.c) * [Test Program](https://github.com/TheAlgorithms/C/blob/master/data_structures/dictionary/test_program.c)