Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 4 Answer(s)

  • Floyd cycle detection algo used to detect the infinite loops inside lists, symlinks, state machines.

    Make two pointer from starting of the list , increment one pointer by 1 and another by 2 on every iteration if both pointer meets it means there is loop.

    If second pointer reaches at the end , it means there is no loop.

    so complexity are O(n) time and O(1) space

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: