Answer to Question #288600 in C++ for Zukar

Question #288600

Head->5->3->7->9->1->Null



TASK :


Node * prev = head ->next;


Node* nodeToInsert = new Node;


nodeToInsert-> data = 4;


nodeToInsert -> next = prev -> next;


prev -> next = nodeToInsert;




(1)Assume that the code represented above in part has executed.


What is the value of prev->data


(2)In addition to the code above, assume the following code executes. Draw a diagram of the list after


this code executes as well.


prev = prev -> next;


Node * curr = prev -> next;


prev -> next = curr -> next;


delete curr;


curr = NULL;

1
Expert's answer
2022-01-18T17:22:34-0500

(1)

head->5->3->4->7->9->1->null
prev->datahas value 3

(2)


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog