ArrayList & Linked Lists

In Java we can dynamically add to a list using an ArrayList (see also this example). It is important to understand some of what is happening here under the surface.

See this example (MS Word) of using an array of nodes to store characters in order. This handout includes an example program (Node.java, LinkedList.java) that illustrates how instead of using a fixed-size array of nodes, we can dynamically allocate a new node and connect it in to the list for each new input.

Reverse.java
           Enter numbers into a linked list, then recursively reverse the list. See accompanying handout (doc).

For further examples illustrating these concepts (however in C++ and not Java), see these notes.


[CS Dept] [UIC] [Prof. Reed]