Overview

This document provides a consolidated architectural summary of essential data structures. It details performance complexities, memory management behaviors, and algorithmic trade-offs across arrays, linked lists, skip lists, heaps, search trees, hash tables, tries, disjoint sets, and graphs.


1. Linear Data Structures

Array List

An Array List is an ADT wrapper built over a dynamic array that automatically resizes when capacity limits are hit.

  • Random Access: Constant-time indexing via contiguous memory calculation.
  • Contiguity: Elements reside in contiguous memory slots with zero gaps.
  • Resizing Logic: Doubling strategy allocates a new array of capacity , copies elements, and frees old memory.

Complexity Analysis

OperationUnsorted Array ListSorted Array List
FindAvg , Worst Avg (Binary Search), Worst
InsertAvg , Best at endAvg (Requires shifting)
RemoveAvg , Best at endAvg (Requires shifting)
Space

Computer Science Introduction/Data Structures/Introductory Data Structures/Linked List

Sequential chains of individual node objects connected via explicit pointers.

  • Singly-Linked: Node tracks data and a single next pointer.
  • Doubly-Linked: Node tracks data, next, and previous pointers.
  • Modification Logic: Pointer redirection takes time once the target node is located.

Complexity Analysis

OperationSingly-Linked ListDoubly-Linked List
FindAvg , Worst Avg
Insert (Head/Tail)
Insert (Middle) search + swap search + swap
Space Overhead (1 pointer/node) (2 pointers/node)

Skip List

A probabilistic data structure augmenting a linked list with multi-level forward pointers, enabling logarithmic lookups.

  • Probabilistic Height: Node levels are assigned via coin flips (probability ).
  • Multi-Level Traversal: Search starts at top level of head node, skipping large spans before dropping down levels.

Complexity Analysis

OperationAverage CaseWorst Case
Find / Insert / Remove (If coin flips degrade to height 1)
Space OverheadExpected Worst

2. Priority & Search Trees

Heap

A complete binary tree enforcing relative priority ordering between parents and children.

  • Array Mapping: Flat array storage where child offsets resolve to and .
  • Heap Invariant: Min-Heap () or Max-Heap ().

Complexity Analysis

OperationComplexityOperational Detail
PeekRoot element lookup at index 0.
Insert (Push)Appends to tail + Bubble-Up rebalancing.
Pop (Extract)Swaps root with tail + Trickle-Down rebalancing.
SpaceFlat contiguous storage with no empty slots.

Binary Search Tree (BST) Variations

StructureFind (Worst)Insert (Worst)Remove (Worst)Balancing Mechanism
Standard BSTNone (Degenerates on sorted input).
RST (Treap)Probabilistic random priorities ( avg).
AVL TreeStrict balance factors () via rotations.
Red-Black TreeRelaxed color rules; optimized for writes.

B-Tree & B+ Tree

“Fat” balanced search trees designed for disk storage and database indexing by maximizing branching factor .

  • B-Tree: Internal nodes store search keys alongside actual data records.
  • B+ Tree: Internal nodes store search keys only; all data records reside exclusively in linked leaf nodes for efficient range sweeps.
MetricB-TreeB+ Tree
Find (Worst)
Data PlacementAny node levelLeaf nodes exclusively
Range QueriesRequires tree traversalFast sequential leaf list walk

3. Hash-Based & String Data Structures

Hash Table & Hash Map

Associative structures mapping keys to array slots via string hash functions .

  • Open Addressing: Linear Probing, Double Hashing, Cuckoo Hashing.
  • Closed Addressing: Separate Chaining (Linked lists or BSTs per bucket).
StrategyFind (Avg)Find (Worst)Key Characteristics
Linear ProbingHigh cache locality; sensitive to clustering ().
Separate ChainingHandles high load factors () gracefully.
Cuckoo Hashing worstGuaranteed lookups via two hash candidate slots.

String Searching Structures

StructureFind (Avg)Space ComplexityPrimary Advantage
Multiway TrieFastest prefix queries; memory inefficient for large alphabets.
Ternary Search Tree (TST)Space-efficient hybrid using 3 child pointers per node.
Disjoint Set (Union-Find)Amortized near-constant time dynamic set partitioning.

4. Graph Representations

RepresentationEdge LookupFind NeighborsSpace ComplexityBest Use Case
Adjacency MatrixDense graphs ()
Adjacency List worstSparse graphs (BFS, DFS, Dijkstra).

5. Master Summary Table

Data StructureSearch (Avg)Search (Worst)Space ComplexityPrimary Optimal Use Case
Array List / / Fast random indexing (Sorted via Binary Search).
Linked ListFrequent head/tail insertions.
Skip ListConcurrent logarithmic ordered lookups.
Heap root arbitraryPriority queue dispatching ( peek).
AVL TreeRead-heavy lookups requiring guaranteed bounds.
Red-Black TreeWrite-heavy general purpose maps (std::map).
B+ TreeDatabase indexing and file system storage.
Hash TableExact match key-value lookups.
Multiway TrieHigh-speed auto-complete with small alphabets.
Ternary Search TreeMemory-efficient dictionary auto-complete.
Disjoint SetKruskal’s MST and connected components.
Adjacency ListGraph traversal algorithms on sparse networks.

Related Notes