struct ListNode {
    int element;
    ListNode *next;

Write a c++ code for all the questions below based on the provided definition of a linked list node.
a)Write a constructor for this struct that initializes an object to the default value, zero and NULL, respectively, and to constructor parameters, e and n, respectively.

b) Use this constructor to create dynamically an object called newNode with the element value 7.

c) Insert newNode after the pointer called prevNode. What is the running time of this operation?

d) Write code that deletes a node after prevNode and displays the value of an element of the deleted node on the screen using cout. What is the running time of this operation?

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now