Question: The foo function at the bottom is foo (front, 2, 10); If it is called with the list shown below, which last option of the

The foo function at the bottom is foo (front, 2, 10); If it is called with the list shown below, which last option of the list is given correctly?

front->6->12->7->3->null

template void foo (node * & front, int pos, const T& item) { node *p = front, *newNode = new node(item); int i; if (pos == 0) front = new node(item, front); else { for (i = 1; i < pos; i++) p = p->next; newNode->next = p->next; p->next = newNode; } }

Please choose one:

a. front -> 6 -> 12 -> 7 -> 10 -> 3 ->null

b. front -> 6 -> 10 -> 12 -> 7 -> 3 ->null

c. front -> 6 -> 12 -> 10 -> 7 -> 3 ->null

d. front -> 6 -> 10 -> 7 -> 3 ->null

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!