1. Engineering
  2. Computer Science
  3. implement a class template for a linkedlistdoubly linked also your...

Question: implement a class template for a linkedlistdoubly linked also your...

Question details

Implement a class template for a LinkedList.(doubly linked). Also, your class will have a tailPtr in addition to a headPtr along with methods to get, set, insert and remove values at either end of the list. Call these  getFirst, getLast, setFirst, setLast, insertFirst, insertLast, removeFirst, removeLast. Don't forget, you also need a copy constructor and destructor plus getLength, isEmpty and clear methods.  Overload the stream insertion operator as a friend function which outputs the list in format { 1, 4, 7 }   (enclosing braces and comma + space between values).  Finally, you'll implement insertAtPosition and removeAtPosition, each of which takes two parameters: the first of type T and the second of type int and inserts or removes a value equal to the first parameter at the position equal to the second parameter. Legal values for the second parameter are from 1 to the list length + 1 for insert and from 1 to the list length for the remove. Out of range values have no effect. BTW positions start with 1 unlike array indexes which start with 0. 

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution