can you plz explain q-9 in linkedlist quiz
Linked list quiz
can you please paste the question here??
because you have asked your doubt on question βll-k-reverseβ so i can see the quiz
Predict the modified doubly linked list of the following code for the given doubly linked list as 1<β> 2 <β> 3 <β> 4 <β> 5 <β>6
CPP
void fun(node **head_ref)
{
node *temp = NULL;
node *current = *head_ref;
while (current != NULL)
{
temp = current->prev;
current->prev = current->next;
current->next = temp;
current = current->prev;
}
if(temp != NULL )
*head_ref = temp->prev;
}
which thing is not clear??
it is simple code if you dry run it
you will get it is reversing the linked list
so ans should be
6 <β> 5 <β> 4 <β> 3 <β> 2 <β> 1