NetApp Interview Question

Given a linked list, determine how to determine if it is circular or not with two pointers?

Interview Answer

Anonymous

Mar 27, 2012

Apply fast iterator approach here. While iteration: slow iterator goes 1 step, fast iterator 2 steps. If we face situation when fastIterator == slowIterator => we have a loop.

4