Question: 4) 15 points. Linked Lists. Consider the linked list template class Node { public: Node(); Node(T value, Node * nextNode); T data; Node * next;
4) 15 points. Linked Lists.
Consider the linked list
template
class Node
{
public:
Node();
Node(T value, Node
T data;
Node
};
template
class LinkedList
{
public:
LinkedList();
Node
Node
void listAppend(T value); // inserts an element at the end of the list
void listPrepend(T value); //inserts a n element at the head of the list
void insertAfter(Node
void removeAfter(Node
void removeHead(); // Removes the first element
void removeTail(); // removes the last element
void printList() const; // print the elements of the linked list
private:
Node
Node
};
Write a template function that receives the head node of a singly Linked list void printEven(Node
template
void LinkedList
{
// Your code goes here.
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
