While this is almost certainly not relevant to any real life metaphorical application of loop detection, I’ll just go ahead and mention that there is a very common cycle detection algorithm in CS that goes like:
Keep two “pointers”. Move one a single step at a time. Move the other two steps at a time. If they are ever equal, then you’re in a loop.
This avoids the need to remember all previous steps, but it doesn’t really seem as useful in the metaphor.
While this is almost certainly not relevant to any real life metaphorical application of loop detection, I’ll just go ahead and mention that there is a very common cycle detection algorithm in CS that goes like:
Keep two “pointers”. Move one a single step at a time. Move the other two steps at a time. If they are ever equal, then you’re in a loop.
This avoids the need to remember all previous steps, but it doesn’t really seem as useful in the metaphor.