
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Suppose input is 63,-15, 99, 45, 545. Draw a diagram that shows the list after the statements below are executed. typedef int ComponentType; struct NodeType; // forward declaration typedef NodeType * NodePtr; struct NodeType // complete the declaration { ComponentType component; NodePtr link; }; NodePtr head; NodePtr currPtr; NodePtr newNodePtr; ComponentType inputVal; head = new NodeType; cin >> head->component; currPtr = head; cin >>inputVal; while (cin) { newNodePtr = new NodeType; newNodePtr ->component = inputVal; currPtr -> link = newNodePtr; currPtr = newNodePtr; cin >> inputVal; } currPtr->link = NULL; Write the statements necessary to add an item whose component field is 123 to the end of the list. Given the changes we’ve made to the list, write the statements necessary to add an item whose component field is 42 after the item whose component field is 99. Given the changes we’ve made to the list, write the statements necessary to add an item whose component field is 24 before the item whose component field is 42. Given the changes we’ve made to the list, write the statements necessary to find the average of the values in the component field of all the items on the list. Given the changes we’ve made to the list, write the statements necessary to delete the first item in the list whose component field is 42.