Question
For C++> Design and implement you own templated linked list class. The class should have the following methods: append : adds a new element to
For C++>
Design and implement you own templated linked list class. The class should have the following methods:
append : adds a new element to the end of the list
insert: adds a new element at a position in the list. The position is an integer value (not an iterator).
delete: deletes a node at a given position. The position is an integer value.
constructor & copy constructor
destructor: must delete all of the nodes
Your linked list can be either a singly-linked list or doubly-linked list. There is a singly-linked list shown in your book and we discussed a doubly-linked list in class. Notice that this linked list class uses a positional value for inserts and deletes. This is different than the implementation in your book.
You will also need to build a driver program that demonstrates the use of all of these methods. You can use any data type as the parameter to your data type.
NOTE: You can force a destructor call by building a function that creates a list object as a local variable. When the function is called and finishes, the destructor for that local list object will be called.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started