Pregunta de entrevista de Yelp

Write a function which reverses a linked list.

Respuesta de la entrevista

Anónimo

5 may 2016

Node * reverse(Node *head){ Node * prev=head; Node *curr=head->next; Node * next=head->next->next; while(next!=NULL){ curr->next=prev; prev=curr; curr=next; next=next->next; } return curr; }

1