Java Reference
In-Depth Information
common errors
The most common linked list error is splicing in nodes incorrectly when
performing an insertion. This procedure is especially tricky with doubly
linked lists.
1.
Methods should not be allowed to access fields via a null reference. We
perform error checks to catch this mistake and throw exceptions as war-
ranted.
2.
When several iterators access a list simultaneously, problems can result.
For instance, what if one iterator deletes the node that the other iterator is
about to access? Solving these types of problems requires additional
work, such as the use of a concurrent modification counter.
3.
on the internet
The singly linked list class, including the sorted linked list, is available, as is
our Collections API list implementation.
LinkedList.java
Contains the implementation for
weiss.nonstandard.LinkedList .
LinkedListIterator.java
Contains the implementation for
LinkedListIterator .
SortLinkedList.java
Contains the implementation for
SortedLinkedList .
LinkedList.java
Contains the implementation of the Collec-
tions API LinkedList class and iterator.
exercises
IN SHORT
17.1
Draw an empty linked list with header implementation.
Draw an empty doubly linked list that uses both a header and a tail.
17.2
IN THEORY
17.3
Write an algorithm for printing a singly linked list in reverse, using
only constant extra space. This instruction implies that you cannot use
recursion but you may assume that your algorithm is a list method.
 
Search WWH ::




Custom Search