SinglyLinkedList: operations, errors and the links followed (hops) ================================================================== addLast(10) -> [10] addLast(30) -> [10, 30] add(1, 20) -> [10, 20, 30] addFirst(5) -> [5, 10, 20, 30] remove(2) -> removed 20, list [5, 10, 30] removeLast() -> removed 30, list [5, 10] removeFirst() -> removed 5, list [10] indexOf(10) -> 0 indexOf(99) -> -1 empty.removeFirst() throws NoSuchElementException: list is empty list.get(5) throws IndexOutOfBoundsException: index 5, size 1 Links followed (hops) per operation, on a list that already holds n values: n | addFirst | addLast no tail | addLast + tail | get(n/2) | indexOf(last) | removeFirst | removeLast 10 | 0 | 36 | 0 | 5 | 9 | 0 | 8 100 | 0 | 4851 | 0 | 50 | 99 | 0 | 98 1000 | 0 | 498501 | 0 | 500 | 999 | 0 | 998 ("addLast no tail" and "addLast + tail" are the total hops to build the whole list of n by repeated addLast.)