ADTs are data types which have certain features and operations, without any explicit implementation. They can be coded however, without any language restriction

Main ADT Types:

  • Lists
  • Arrays
  • Sets
  • Stacks
  • Queues
  • Priority Queues
  • Dictionaries
  • Graphs

Lists

Definition

Lists are data structures used when the number of elements is unknown.

  • Lists are without index.
  • Traditionally, only the first (head) and the remaining items (tail) can be viewed
  • Lists have dynamic size, and can grow or shrink as needed.
  • Items are added (to the end) via appending
Link to source


Arrays

Definition

  • A data structure with a set length
  • Items are accessed via their index, which is a number that stores their location
  • They are static (a fixed size)
  • Items are added to arrays by overwriting previous value via index
Link to source


Sets

Definition

  • Data structure to store unique objects i.e. objects can’t be repeated
  • Similar to math sets, union, intersection, difference, etc. can be applied
  • Sets can be static or dynamic, but usually dynamic.
Link to source


Stacks

Definition

  • A collection of items, which are accessed in Last In First Out (LIFO) order
  • Only the top (head) can be viewed (via peek) or returned (via pop)
  • Adding new items is referred to as pushing
  • Removing items is referred to as popping
  • The last item to enter a stack is the first to come out of it
Link to source


Queues

Definition

  • A collection of items accessed in First In First Out (FIFO) order
  • Only the front can be viewed (similar to stacks)
  • Adding items is referred to as enqueuing
  • Removing items is referred to as dequeuing
  • The first item that was added to a queue is also the first item to leave it
Link to source


Priority Queues

Definition

  • A variation of the normal queue ADT, where items are also given a priority/rank
  • Priority queues can either be minimum or maximum:
    • Minimum PQueues sort elements with the lower priority first
    • Maximum PQueues sort elements with the higher priority first
  • The same operations of the queue apply here, such as enqueue, dequeue, etc.
Link to source


Dictionaries

Definition

  • Also known as associative arrays, dictionaries store items in <key, value> pairs
  • The <key> is used to access the <value>
  • Generally, dictionaries are considered to be dynamic, i.e. they can grow/shrink
Link to source


Graphs

Definition

Graphs are ADTs used to represent connected concepts with nodes/vertices and edges. A graph is an ordered pair of nodes and edges, expressed as

Variations of graphs can have different features, which can be used to model other properties. A few include:

  • Weights
  • Direction of edges
  • Node and/or edge attributes
Link to source