Esri Interview Question: How can you find the center o... | Glassdoor

Interview Question

Software Applications Authentication Product Engineer Interview Redlands, CA

How can you find the center of a linked list using only a

  single operation to pass through each member?

Interview Answer

1 Answer


My answer was to load the items into an array, but the expected answer is to use two pointers to walk through the list. The first pointer progresses one link at a time while the second progresses two links at a time. Thus, when the second pointer reaches the end, the first pointer is at the midpoint.

Interview Candidate on Nov 1, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.