Microsoft Interview Question

How would you find the median in a sorted circularly linked list given a random node.

Interview Answer

Anonymous

Nov 2, 2015

Find the size and the starting node.The starting node is the first node where the linked list stops incrementing. Move size/2 nodes from the start and return either the median node if odd or the mean of the two median nodes if even.