Thoughtworks Interview Question

How do you find the middle element in a linked list?

Interview Answer

Anonymous

Aug 28, 2017

Have two pointers. One pointer should jump two elements for every traversal and another single element. When first reached the end and the element which second is pointing is the middle element

1