Empresa activa
how to reverse a link list
Anónimo
It is really not difficult question. But make sure you better practicing writing the codes on whiteboard and pay attention to the details.
How about pushing them in stack as you traverse forward, and link them in reverse as you pop them out.
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; }
Sigue a tus empresas favoritas para estar al tanto de las últimas oportunidades y disponer de información de primera mano.
Recibe recomendaciones y actualizaciones personalizadas al iniciar tu búsqueda.