Most problems reduce to a handful of ADTs: list, stack, queue, deque, priority queue, set, map and graph. Each has simple operations, and the cost depends on the implementation. This lesson gives that catalog as one table and a few small examples. The difference between an ADT and a structure is in the previous lesson.

Eight ADT cards with operations and Python implementations
Eight ADT cards with operations and Python implementations

The catalog

By operations there are four families: sequences (list, stack, queue, deque), the priority queue, key and membership (set, map) and relations (graph).

ADTMain operationsTypical implementation
Listget(i), insert, removedynamic array, linked list
Stackpush, pop, peeklist, linked list
Queueenqueue, dequeuedeque, circular buffer
Dequepush/pop at both endscollections.deque
Priority queuepush, pop_min, peekbinary heap (heapq)
Setadd, remove, inhash table, tree
Mapput, get, deletehash table, tree
Graphadd_edge, neighborsadjacency list, matrix

Python provides most of these ADTs ready-made: