1.5.2 List Type1.5.1 List Nodes1.5 Dynamic Data Structures1.5.3 Inserting List Elements

1.5.2 List Type

A list is actually an abstraction that should be separated from its implementation as a sequence of linked nodes. We therefore introduce the following class declaration:

  class List
  {
    Node head;
    List()
    {
    }
    ...
  }

where the object field head refers to the first node of the list (if any). This allows us to declare an empty list as

  List empty = new List()

In the following, we will develop various useful list operations as object methods of List.

The following applet illustrates these operations.

If you don't see the applet, your Browser does not support Java. Click here, to view a precomputed image.
You can use the Ins button to insert new elements into the list; Find allows you to search for a particular list element; Del removes an element from the list. The selection Sorted or Unsorted gives you control whether the list elements are sorted or not.

Applet


© Wolfgang Schreiner; February 3, 2005

1.5.2 List Type1.5.1 List Nodes1.5 Dynamic Data Structures1.5.3 Inserting List Elements