Question: Assume the following Node structure for singly linked lists struct Node int data struct Node nextPtr; 1. Multiply all the values in the linked list
Assume the following Node structure for singly linked lists struct Node int data struct Node nextPtr; 1. Multiply all the values in the linked list by the given variable, mult. n initially points to the dummy header for the list. The dummy header should not be modified void multiplyBy (Node* n, int mult) 2. Return the number of nodes in the inked list. n initially points to the dummy header for the list. The dummy header should not be counted int listsize (Node* n) 3. Remove b from the list. a is the node that comes before b, can be NULL c is the node that comes after b, can be NULL void removeSingle (Node a, Nodeb, Node c) 4. Add b into the list to come after and and beforec a is the node that comes before b, cannot be NULL c is the node that comes after b, can be NULL void addSingle (Nodea, Node b, Node c) 5. Add all the values in the linked list and return the sum n initially points to the dummy header for the list. The dummy header should not be included in the sum. int add (Node n) 6. Return how many times the given target value appears in the linked list n initially points to the dummy header for the list. The dummy header should not be counted void count (Node n, int target) 7. Return the sum of the largest two items in the singly linked list Assume the list will have at least 2 nodes (other than the header). n initially points to the dummy header for the list. The dummy header should not be modified int sumOfMax2 (Node* n)A
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
