What would be the contents of the list if the following function is invoked ?
void myfun (struct node *head)
{
struct node * p, * q ;
int temp ;
if (! head || ! head → next)
return ;
p = head ; q = head → next ;
while (q) {
temp = p → data ;
p → data = q → data ;
q → data = temp ;
p = q → next ;
q= p ?p->next :0
}
}
1
2, 1, 4, 3, 6, 5, 7
2
2, 3, 4, 5, 6, 7, 1
3
1, 2, 3, 4, 5, 6, 7
4
1, 3, 2, 5, 4, 7, 6