Question: A question in data structures and algorithms: You have been given the task of implementing a double-linked list in C that stores binary search trees
A question in data structures and algorithms:
You have been given the task of implementing a double-linked list in C that stores binary search trees with a single data structure. Below you see what was finished when you received the task. Implement the five functions: pnode bst_create(), pnode bst_cons(), pnode bst_add(), pnode add_tree(), void add_to_tree().
typedef struct node* pnode; typedef struct node{ void* data; pnode one; pnode two; }node; pnode bst_create(void* data){/* TODO - create new tree node */ } pnode bst_cons(pnode L, pnode N, pnode R){/* TODO - construct a tree */} pnode bst_add(pnode root, void* data){ /* TODO - place value in BST */} pnode add_tree(pnode head){ /* TODO - add new empty tree to list */} void add_to_tree(pnode head, int what_tree, void* data){ /* TODO - add data to specified tree in list */} Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
