You are viewing a single comment's thread. Return to all comments →
just change the order, i.e, while(Fast != null && Fast.next != null). bcoz if Fast is already null then Fast.next will give segmentation fault
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
just change the order, i.e, while(Fast != null && Fast.next != null). bcoz if Fast is already null then Fast.next will give segmentation fault