Re:Linked List Problems (2002) [pdf]
by atsushin on Sunday November 26, 2017 @03:18AM
(#15779976)
Hi! Just a question, since I've never been good with proofs. Why use the modulo operator in the while-loop? Couldn't we just test if i != j?
[ Parent
| on HN ]
Re:Linked List Problems (2002) [pdf]
by tomjakubowski on Sunday November 26, 2017 @03:37AM
(#15780027)
The modulo represents the cycle.
Maybe it would be helpful to rewrite the loop with a condition as you described, and %= i and j with n after incrementing (by 1 or by 2) both variables in the loop body.