CSC300: Insertion logic [3/7] |
To create this, you work in pieces: first get the insert logic.
11 |
public void insert (double item) { Node x = first.next; Node y = new Node (item, null); Node f = x.next; x.next = y; y.next = f; } |
Passes some tests (inserts the item after first, as long as list is not empty)
Now figure out the loop.
As with all loops we work in pieces: