Question: Java Lab 2: Linked Lists Begin with the linked list package linked to the course web page (links section). The existing code is designed to
Java
Lab 2: Linked Lists
Begin with the linked list package linked to the course web page (links section). The existing code is designed to avoid cycles.
Add a method public void addToCreateCycle(Node
Write JUnit tests that create a) a list with no nodes; b) a list with nodes but no cycles; c) a list with only one node with its next reference set to itself; d) a list with a cycle whose length (number of nodes involved in the cycle) is odd; e) a list with a cycle whose length is even. The tests should use assertions to determine whether each list contains a cycle. You do not need to determine where the cycle begins, only whether there is a cycle.
Turn in the unchanged Node.java file, the edited SinglyLinkedList.java file, and your JUnit tests.
We just learned the generics, and linked lists, can anyone help for this?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
