Domanda di colloquio di Meta

reserve linked list

Risposta di colloquio

Anonimo

22 apr 2012

void reverse() { node* a=head; if(a==NULL) return; node *b=a->next; if(b==NULL) return; node *c=b->next; while(b!=NULL) { b->next=a; a=b; b=c; if(c!=NULL) c=c->next; } head->next=NULL; head=a; }

1