Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed
[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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Find square matrices A and B such that |A + B| |A| + |B|.

Answered: 1 week ago