Question: (I need help with these problems) 1. 2. 3. 4. I am trying to delete the a node in the middle of a singly linked

(I need help with these problems) 1.

(I need help with these problems) 1. 2. 3. 4. I am

trying to delete the a node in the middle of a singly

2.

linked list. I currently have a pointer called pres, which points to

the address of the node I want to delete and a pointer

3.

called prev, which points to the address of the node before the

4.

one I want to delete, as seen below: data next data next

data next data next 3 10 2 1 NULL head prev pres

I am trying to delete the a node in the middle of a singly linked list. I currently have a pointer called pres, which points to the address of the node I want to delete and a pointer called prev, which points to the address of the node before the one I want to delete, as seen below: data next data next data next data next 3 10 2 1 NULL head prev pres What do I do to delete the node pointed to by pres? prev->next = pres->next; delete pres; delete pres; pres->next = prev->next; delete prev: O prev->next = pres->next; delete pres delete pres pres->next = prev->next; delete prev; delete pres; delete prev: prev->next = NULL; delete pres; prev->next = head; delete pres; 1 2 3 4 NULL Data next next Data Data next Data next B 0 Data next Head prev curr You are trying to insert node B between A and C. Which of the following pieces of code will correctly do so? Option 1: prev->next = curr; curr->next = prev->next; Option 2: curr->next = prev->next; prev->next = curr; Option 3: curr->next = prev; prev->next = curr; Option 4 prev->next = curr; curr->next = prev; Option 4 Option 3 O Option 2 Option 1 tempt temp4 0 1 N 3 3 O 4 NULL Data next Data next Data next A temp2 temp3 Head Given a linked list above, we would like to insert a new node A at the start of the list. Which of the following code segments are correct? Select all that applies. Notice that pointer tempt and temp2 point to node A, pointer temp3 and temp4 point to the original first node. temp1->next = temp4; head = temp2; temp1 ->next = head: head = temp1; head = head->next; temp2->next = head; head = temp1 head ->next = temp3: You want to write code that will delete the node with the Data value 4 from this linked list. You start by initializing pointers prev and pres so that prev points to NULL and pres points to the head of the list, as shown: 1 H 2 2 3 4 NULL Data next Data next Data next Data next NULL prev Head pres Your code traverses the list so that prev and pres are always offset by one. For example, after one iteration, prev points to the head and pres points to head->next, as shown: 1 2 3 4 O NULL Data next Data next Data next Data next Head prev pres When you delete pres, what will be the value of prev->Data? NULL O2 4 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!