Use C++ Programming language: Design and implement your own linked list class to hold a sorted list of integers in ascending order.  The class should have member functions for inserting an item in the list (in ascending order), deleting an item from the list, and searching the list for an item. Note: the search function should return the position of the item in the list (first item at position 0) and -1 if not found. In addition, it should have member functions to display the list, check if the list is empty, and return the length of the list.  Be sure to have a class constructor  a class destructor, and a class copy constructor for deep copy. Demonstrate your class with a driver program (be sure to include the following cases: insertion at the beginning, end (note that the list should alway insert in ascending order.  However, in your test include a case where the inserted item goes at the beginning of the list), and inside the list, deletion of first item, last item, and an item inside, searching for an existing/non-existing item, and  modifying a list that was initialized to an existing list.

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
Question

Use C++ Programming language:

Design and implement your own linked list class to hold a sorted list of integers in ascending order.  The class should have member functions for inserting an item in the list (in ascending order), deleting an item from the list, and searching the list for an item. Note: the search function should return the position of the item in the list (first item at position 0) and -1 if not found.

In addition, it should have member functions to display the list, check if the list is empty, and return the length of the list.  Be sure to have a class constructor  a class destructor, and a class copy constructor for deep copy. Demonstrate your class with a driver program (be sure to include the following cases: insertion at the beginning, end (note that the list should alway insert in ascending order.  However, in your test include a case where the inserted item goes at the beginning of the list), and inside the list, deletion of first item, last item, and an item inside, searching for an existing/non-existing item, and  modifying a list that was initialized to an existing list.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
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