The Array-Backed List

Agenda

  1. The List Abstract Data Type (ADT)
  2. A List Data Structure
  3. Our List API
  4. NumPy Array
  5. The ArrayList data structure

1. The List Abstract Data Type (ADT)

An abstract data type (ADT) defines a conceptual model for how data may be stored and accessed.

A list ADT is a data container where:

Other common ADTs (some of which we'll explore later) include:

2. A List Data Structure

A list data structure is a concrete implementation of the list ADT in some programming language, which, in addition to adhering to the basic premises of the ADT, will also typically support operations that:

The implementation of any data structure will generally rely on simpler, constituent data types (e.g., "primitive" types offered by the language), the choice of which may affect the runtime complexities of said operations.

3. The List API

The operations we'll be building into our list data structures will be based on the common and mutable sequence operations defined by the Python library.

4. NumPy Array

For the ArrayList's underlying data storage mechanism you will use the NumPy array. You will be using a very limited subset of the available APIs for working with NumPy arrays, however. Specifically, you may use:

You should not use any other array-related functions provided by NumPy! Notably, delete, insert append, resize, and others, are off limits. Using them to carry out list operations is, generally speaking, less efficient than the manual approach outlined in class. Also, it's important that you learn how to implement them yourself. Breaking this rule will result in significant score reduction(s).

5. The ArrayList data structure