Contents [0/7] |
Does this work? [1/7] |
Does this work? [2/7] |
Does this work? [3/7] |
Does this work? [4/7] |
Does this work? [5/7] |
Does this work? [6/7] |
Does this work? [7/7] |
(Click here for one slide per page)
Does this work? [1/7] |
01 |
public void insert (double item) { insertH (first, item); } private static void insertH (Node x, double item) { if (x.next == null || x.next.item >= item) { x.next = new Node (item, x.next); } else { insertH (x.next, item); } } |
Does this work? [2/7] |
01 |
public void insert (double item) { if (first == null || first.item >= item) { first = new Node (item, first); } else { insertH (first, item); } } private static void insertH (Node x, double item) { if (x.next == null || x.next.item >= item) { x.next = new Node (item, x.next); } } |
Does this work? [3/7] |
01 |
public void insert (double item) { if (first == null || first.item >= item) { new Node (item, first); } else { insertH (first, item); } } private static void insertH (Node x, double item) { if (x.next == null || x.next.item >= item) { x.next = new Node (item, x.next); } else { insertH (x.next, item); } } |
Does this work? [4/7] |
01 |
public void insert (double item) { if (first == null || first.item >= item) { first = new Node (item, first); } else { insertH (first, item); } } private static void insertH (Node x, double item) { if (x.next == null || x.next.item >= item) { new Node (item, x.next); } else { insertH (x.next, item); } } |
Does this work? [5/7] |
01 |
public void insert (double item) { insertH (first, item); } private static Node insertH (Node x, double item) { if (x == null || x.item >= item) { return new Node (item, x); } else { x.next = insertH (x.next, item); return x; } } |
Does this work? [6/7] |
01 |
public void insert (double item) { first = insertH (first, item); } private static Node insertH (Node x, double item) { if (x == null || x.item >= item) { return new Node (item, x); } else { insertH (x.next, item); return x; } } |
Does this work? [7/7] |
01 |
public void insert (double item) { first = insertH (first, item); } private static void insertH (Node x, double item) { if (x == null || x.item >= item) { new Node (item, x); } else { x.next = insertH (x.next, item); } } |