Pergunta de entrevista da empresa Morgan Stanley

How to delete the last three nodes in a singly linked list?

Resposta da entrevista

Sigiloso

4 de ago. de 2011

Have two pointers say front and behind.. Advance front pointer and make the behind pointer 2 nodes back.. When the front pointer reaches end delete the node and delete the 2 pointers from pointer behind.. thats it you have deleted the last 3 nodes..