Pergunta de entrevista da empresa National Instruments

Given a linked list, write a function that will print the list in reverse.

Respostas da entrevista

Sigiloso

7 de abr. de 2011

Do this in linear O(n) time without recursion and without creating a copy of the list. [Hint] You can modify the list, as long as you put it back the way it started.

Sigiloso

9 de jan. de 2013

Traverse the list from start to end updating the link addresses such that the second node points to first, third node points to second and so on. when we reach the last node we will have reverse list. Now repeat the whole process but this time printing the elements of the nodes. We will get the original list back and items printed are in reverse order as well. I am proud of myself !! :)