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
.