This problem is known as cycle detection, and there are a number of different solutions, depending on your requirements.
Repeat visits to a node in the structure tell you nothing about whether the traversal is finite.
I'm not sure what you mean by that. Repeat visits to a node tell you that you're in a cycle, and you'll keep going around forever unless you break out (as Floyd's code does).
Most sort algorithms won't loop infinitely if the comparison function is inconsistent. They'll just return the list in a non-meaningful order.
In reply to Re^3: Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)
by Anonymous Monk
in thread Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)
by anonymized user 468275
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |