CSC300 / CSC402: Insertion logic [2/6] |
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: