Question: Consider the following structure: struct Node { Node *prev; int key; Node *next; }; Consider a pointer named head that points to the first node

Consider the following structure:

struct Node { Node *prev; int key; Node *next; };

Consider the following structure: struct Node { Node *prev; int key; Node

Consider a pointer named head that points to the first node in the linked list, a pointer named tail that points to the last node, a pointer named temp that points to the node with value 10 and a node named newnode with the value 15.

After executing following code:

newnode->prev = temp;

temp->next->prev = newnode;

temp->next = newnode;

newnode->next = temp->next;

what will be the output if we print the linked list from tail to head?

Select one:

a. infinite loop

b. Segmentation fault

c. none of these

d. 12 5 10 7 3

e. 3 7 10 15 5 12

f. 12 5 15 10 7 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!