Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:42:26+00:00 2026-06-05T16:42:26+00:00

Today I was reading Floyd’s algorithm of detecting loop in a linked list. I

  • 0

Today I was reading Floyd’s algorithm of detecting loop in a linked list.
I was just wondering that won’t it be better if we skip more than one node, (say 2)
for faster loop detection?

For example:

fastptr=fastptr->next->next->next.

Note that the side effects will be taken into account while changing fastptr.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:42:28+00:00Added an answer on June 5, 2026 at 4:42 pm

    Your suggestion still is correct, but it doesn’t change the speed of algorithm. If you take a look at tortoise and hare algorithm in wiki:

    The key insight in the algorithm is that, for any integers i ≥ μ and k
    ≥ 0, xi = xi + kλ, where λ is the length of the
    loop to be found and μ is start position of loop. In particular,
    whenever i = kλ ≥ μ, it follows that xi =
    x2i
    .

    In the bold part, you could also say xi = x3i, or any other coefficient, but key insight is finding the i, it’s not important with how many jumps you will find it, and order of algorithm, depends to the location of i.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading today about OOCSS which says by using that approach have 2
I started reading about underscore.js today, it is a library for javascript that adds
I just began reading more about Markov Chain Generators today, and am really intrigued
I was reading today about researchers discovering that NVidia's Phys-X libraries use x87 FP
I just started C# today, and i have trouble reading an excel file. Here's
I've just started learning Python today. I've been reading a Byte of Python. Right
I was reading something today and came across a statement that said: Lazy instantiation
Today, reading Servlet 3.0 specification, I've come across a sentence: We emphasize that this
I'm just starting out with Perl (literally today) and I'm reading the free online
I always read about the horrible thing that goto is. But today, reading about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.