Pergunta de entrevista da empresa SAP

How to find midpoint of a linked list.

Resposta da entrevista

Sigiloso

10 de fev. de 2015

Take two pointers: t1,t2; node t1,t2; t1=head; t2=head; While(t1!=null){ t1=t1->next; t1=t1->next; t2=t2->next; } The moment t1 reaches the end, t2 will at the middle of linklist.