Domanda di colloquio di Tripadvisor

Reverse a linked list

Risposta di colloquio

Anonimo

10 gen 2013

You could either first iterate over the linked list removing the items and putting them in stack, then iterate over the stack popping off the top element and inserting it back into the linked list. You could also use recursion, but its less obvious.