()
| 216 | } |
| 217 | |
| 218 | public boolean isCycle() { |
| 219 | Node slow = head; |
| 220 | Node fast = head; |
| 221 | while(fast!=null && fast.next!=null) { |
| 222 | fast = fast.next.next; |
| 223 | slow = slow.next; |
| 224 | if(fast == slow) { |
| 225 | return true; |
| 226 | } |
| 227 | } |
| 228 | return false; |
| 229 | } |
| 230 | |
| 231 | public Node removeCycle() { |
| 232 | Node slow = head; |
nothing calls this directly
no outgoing calls
no test coverage detected