Question: YOUR PROGRAM For your lab, you will implement a template version of a linked list, capable of using any comparable types (types for which the

YOUR PROGRAM

For your lab, you will implement a template version of a linked list, capable of using any comparable types (types for which the relational operators are defined). You will need to define the following templates (most of these have already been implemented in the demos in class, or can be modified from the examples seen in class):

  • The Node struct
  • A recursive function to display the contents of the linked list.
  • A recursive function to calculate the length of the linked list.
  • A function to add an element to an already sorted linked list.
  • A function to delete an element from a sorted linked list.
  • A function to search for an element in the linked list.

In the main, you will first create a new linked list capable of storing doubles, and populate the linked list with the contents of the numbersUnsorted.txt text file that is provided with the lab. Then, use a menu-driven program to provide the user with the following options:

  • Display the contents of the linked list
  • Display the length of the linked list
  • Add a new element to the linked list in sorted order
  • Delete an element from the linked list
  • Search for an element in the linked list (not included in screenshots)
  • Exit the program

SAMPLE SCREENSHOTS

Display the initial list contents (read from the file) and the length of the list:

YOUR PROGRAMFor your lab, you will implement a template version of a

[T C:\\Users\\lsilcox_4231\\Documents\\Visual Studio 2017\\Projects\\ Linked List Options : 1) Display list contents 2) Display list length 3) Insert an element 4) Remove an element 5) Exit menu Current List Contents: 10.78 13.37 16.68 29 .44 34.82 42.01 43.57 54.57 57.' 64 78 .25 80.01 99.99 Linked List Options : 1) Display list contents 2) Display list length 13 Insert an element 4 Remove an element 5 Exit menu > > 2 Current List Length: 13

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!