AlgoInsight

Q&A

What are abstract data types?

By AlgoInsight Team2026-06-18arraysdata-structuresoop

Overview

An ADT specifies the what - the operations and their semantics - and hides the how. The same ADT can have multiple concrete implementations with different performance trade-offs. This is the principle behind Java's List, Queue, and Map interfaces, Python's abstract base classes, and virtually every programming language's collection types.

graph TD
    A[Abstract Data Type] --> B[Defines: WHAT operations exist + their contracts]
    A --> C[Hides: HOW they are implemented]
    B --> D["Stack ADT: push, pop, peek, isEmpty"]
    D --> E[Implementation 1: array-based]
    D --> F[Implementation 2: linked-list-based]
    style A fill:#1e1b4b,color:#fff

Key ADTs and Their Operations

Stack (LIFO)

Queue (FIFO)

List (ordered, index-accessible)

Map / Dictionary (key→value)

Set

ADT vs Data Structure

Abstract Data Type Data Structure
Level Logical/mathematical Concrete/implementation
Defines Operations + semantics Memory layout + algorithms
Example Stack Array-based stack, linked-list stack
Concern Behavior contract Efficiency and mechanics

ADT in Code: Interface as Contract

In Java, the interface is the ADT; the implementing class is the concrete data structure:

// ADT as interface:
interface Stack<T> {
    void push(T item);
    T pop();
    T peek();
    boolean isEmpty();
}

// Concrete implementation 1:
class ArrayStack<T> implements Stack<T> { /* array-based */ }

// Concrete implementation 2:
class LinkedStack<T> implements Stack<T> { /* linked-list-based */ }

Code that programs to the Stack interface works with either implementation.

In Python, ADTs are expressed through abc.ABC and abstractmethod, or informally via duck typing.

Why ADTs Matter

Why This Matters in Interviews

ADT questions test whether you think in abstractions before implementations. Know the core ADTs (stack, queue, list, map, set) and their canonical operations; understand the ADT = interface, data structure = implementation distinction; and articulate that the separation enables polymorphism and hides complexity. Connecting ADTs to language constructs (Java interfaces, Python ABCs) and explaining that different implementations (ArrayList vs LinkedList) trade off different complexities for the same ADT is the depth signal.

Common Pitfalls

References

More answers