(String[] args)
| 36 | } |
| 37 | |
| 38 | public static void main(String[] args) { |
| 39 | int list_length = 100; |
| 40 | int k = 10; |
| 41 | |
| 42 | // Create linked list |
| 43 | LinkedListNode[] nodes = new LinkedListNode[list_length]; |
| 44 | for (int i = 0; i < list_length; i++) { |
| 45 | nodes[i] = new LinkedListNode(i, null, i > 0 ? nodes[i - 1] : null); |
| 46 | } |
| 47 | |
| 48 | // Create loop; |
| 49 | nodes[list_length - 1].next = nodes[list_length - k]; |
| 50 | |
| 51 | LinkedListNode loop = FindBeginning(nodes[0]); |
| 52 | if (loop == null) { |
| 53 | System.out.println("No Cycle."); |
| 54 | } else { |
| 55 | System.out.println(loop.data); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | } |
nothing calls this directly
no test coverage detected