Skip to content

Hash map [mp]

Micro pattern

Description

Associate keys with values for efficient average-case lookup and updates.

Problems

Frequency maps

Map values or derived keys to occurrence counts.

Grouping maps

Map canonical keys to collections of corresponding original values.

Value or state to index

Remember a value's position for later complement, split, repetition, or deletion operations.

Parent mapping

Record parent links to permit upward movement without changing the original structure.

Bidirectional mapping

Maintain both directions when two sets of values must correspond one-to-one.

Hash map combined with linked ordering

Use a map for lookup and linked ordering for fast recency changes.

Implementation

Resolve keys through hashed buckets and resize as occupancy grows.

Value-indexed dynamic states

Map a state key to its best result after processing the input prefix.