for the cycle detection cycle,I understood the answer but removal of a cycle in linked list does not make sense to me.If one of the links in a node points back to a previous node then there is no way I can say what it should have pointed to in the first place.
I think the point of the exercise is to detect that the linked list is invalid. A program trying to iterate will never complete. This is what you are testing for - what the list should have been is undeducible.
I think 'break the loop' means to find the link that points back to a previous link and make the list end there, thus converting it to an unlooped list with the same elements in the same order.
Hmmm. I must have missed something.
Fog Creek Home