CSC300 / CSC402: Cleanup [6/6] Previous pageContents

11
12
13
14
15
16
17
18
19
20
21
  public void insert (double item) {  
    if (first == null || first.item >= item) {
      first = new Node (item, first);
    } else {
      Node x = first;
      while (x.next != null && x.next.item < item) {
        x = x.next;
      }
      x.next = new Node (item, x.next);
    }
  }

Previous pageContents