

MCQOPTIONS
Saved Bookmarks
1. |
The following C function takes a simply-linked list as input argument. typedef struct node { int value; struct node *next; }Node; Node *move_to_front(Node *head) { Node *p, *q; if ((head == NULL: || (head->next == NULL)) return head; q = NULL; p = head; while (p-> next !=NULL) { q = p; p = p->next; } _______________________________ return head; } |
A. | q = NULL; p->next = head; head = p; |
B. | q->next = NULL; head = p; p->next = head; |
C. | head = p; p->next = q; q->next = NULL; |
D. | q->next = NULL; p->next = head; head = p; |
Answer» E. | |