Domanda di colloquio di Amazon

Reverse a singly linked list

Risposta di colloquio

Anonimo

13 gen 2012

Traverse the list once to find a pointer to the tail node. Traverse the list again and insert the current node directly after the tail node you originally found. Stop when you reach the tail node. Then, set the tail to the head.