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

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

front-> 9 -> 30 -> 17 -> 4 -> 20 ->null

template void foo (node * & front) { node *prev, *curr, *p; if (front != NULL || front->next != NULL) { curr = front->next; prev = front; do { p = curr->next; curr->next = prev; if (p != NULL) { prev = curr; curr = p; } } while (p != NULL); front->next = NULL; front = curr; } }

Please choose one:

a.

front->20->4->17->30->9->null

b.

front->9->30->17->30->9->null

c.

front->9->4->17->30->20->null

d.

front->20->17->30->4->9->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!