Question: I need help doing this data structure assignment please. I need to write the code in C language. Thanks. CS 2123 Data Structures Due Friday
CS 2123 Data Structures Due Friday March 4 1. (100 pts) Write a program to convert a sorted double-linked list to a binary search tree. You can only change the target of pointers, but cannot create any new modes. Use previous node in doubly-linked list as left pointer of binary search tree and next node in doubly-linked list as right pointer of binary search tree. Consider the double-linked list given below 10 12 l6 Figure 1: Doubly-linked List The binary search tree that is output of this process is Figure 2 Binary Search Tree It will be easier to write this program using recursion. Find the middle node in the doubly linked list and set it as root, convert the left sublist and set it as left subtree, convert the right sublist and set it as right subtree. Test your program with different doubly linked lists To test your binary search tree, you can print the contents Sample execution of the program is given below foxol> assiga Enter nunbers for doubly linked list in sorted order 4 6 8 10 12 14 16 Doubly Linked List Contents 4 6 8 10 12 14 16 Binary Search Tree Contentis 4 6 8 10 12 14 16 Subnit your program electronically using the blackboard syste The program you submit should be your osn work. Cheating will be reported to office of academic integrity. Both the copier and copier and copice will be held responsible
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
