C Programming language Part 1: You need to define a data structure for a doubly linked list and a binary search tree. Also, you need to implement the following functions: Insert Sorted LINKEDLIST insertSorted(LINKEDLIST head, int num): head points to the first node in the sorted linked list; num is a number to be inserted in in correct place in the linked list pointed at “head”. The linked list should be sorted after inserting “num”. This function returns the head of the modified head. BSTREE insert(BSTREE root, int num): root points to a node in a binary search tree; num is a number to be inserted in the tree rooted at “root”. This function returns the root of the modified tree. Find an element LINKEDLIST find(LINKEDLIST head,int num): head points to the first node of a linked list; num is a number to be searched for in the linked list started at “head”. This function returns a pointer to the node containing “num” or NULL if num is not found BSTREE find(BSTREE root,int num): root points to the root of a binary search tree; num is a number to be searched for in the tree rooted at “root”. This function returns a pointer to the node containing “num” or NULL if num is not found. Print Elements void LinkedListTraversal(DLINKEDLIST head, FILE *fp): head points to the first node in a linked list. This function does not return anything, but prints out, to the file specified, the nodes in the doubly linked list pointed by “head”. void inorderTraversal(BSTREE root, FILE *fp): root points to a node in a binary search tree. This function does not return anything, but prints out, to the file specified, the nodes in the tree rooted at “root” by performing an inorder traversal.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18SA
icon
Related questions
icon
Concept explainers
Question

C Programming language

Part 1: You need to define a data structure for a doubly linked list and a binary search tree. Also, you need to implement the following functions:

  1. Insert Sorted

    • LINKEDLIST insertSorted(LINKEDLIST head, int num): head points to the first node in the sorted linked list; num is a number to be inserted in in correct place in the linked list pointed at “head”. The linked list should be sorted after inserting “num”. This function returns the head of the modified head.

    • BSTREE insert(BSTREE root, int num): root points to a node in a binary search tree; num is a number to be inserted in the tree rooted at “root”. This function returns the root of the modified tree.

  2. Find an element

    • LINKEDLIST find(LINKEDLIST head,int num): head points to the first node of a linked list; num is a number to be searched for in the linked list started at “head”. This function returns a pointer to the node containing “num” or NULL if num is not found

    • BSTREE find(BSTREE root,int num): root points to the root of a binary search tree; num is a number to be searched for in the tree rooted at “root”. This function returns a pointer to the node containing “num” or NULL if num is not found.

  3. Print Elements

    • void LinkedListTraversal(DLINKEDLIST head, FILE *fp): head points to the first node in a linked list. This function does not return anything, but prints out, to the file specified, the nodes in the doubly linked list pointed by “head”.

    • void inorderTraversal(BSTREE root, FILE *fp): root points to a node in a binary search tree. This function does not return anything, but prints out, to the file specified, the nodes in the tree rooted at “root” by performing an inorder traversal.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 8 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning