Pergunta de entrevista da empresa Cisco

how to reverse a link list

Respostas da entrevista

Sigiloso

31 de out. de 2009

It is really not difficult question. But make sure you better practicing writing the codes on whiteboard and pay attention to the details.

Sigiloso

22 de fev. de 2010

How about pushing them in stack as you traverse forward, and link them in reverse as you pop them out.

Sigiloso

1 de out. de 2014

revereseList ( struct node * head) { struct node *next, *current, *prev; if (head == null) return null; current = head; prev = null; while (current != null) { next = current->next; current->next = prev; prev = current; current = next; } head = prev; }