Question: Initially, when the list is empty, the HEAD and TAIL pointers will be NULL . The class should contain the following functions: A constructor that
Initially, when the list is empty, the HEAD and TAIL pointers will be NULL. The class should contain the following functions:
A constructor that initialize the HEAD and TAIL pointers to NULL.
void travere(); // It prints the list values.
-
void insertAtHead(int); // It inserts a new node at the beginning of
the list.
-
node * search (int); // It searches for a given value and returns the
address of the node containing the given value.
Note: if the given value is not found, the function will return NULL.
-
void insertAfter(int,int);// It inserts a new node after a given
value. Note: if the given value is not found, the function will do nothing.
Inside the main function, the user should be able to choose one function at a time from the above functions, and when the user entered -1, the program should be terminated.
You should also attach a screenshot of the program output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
