Skip to content

Hash-set pattern [mp]

Micro pattern

Description

Store unique values or states when membership rather than an associated value is needed.

Problems

Detect duplicates or revisited states

Check membership to detect repeated inputs, visits, or generated states.

Enforce uniqueness constraints

Reject repeated values within a normalized or local constraint region.

Track visited graph states

Mark states at discovery so they are not explored repeatedly.

Membership-driven sequence scans

Start at sequence boundaries and extend while successors are present.

Dictionary membership

Use a set to validate candidate words or scheduled dates.

Ancestor membership

Store one node's ancestors to find a shared ancestor efficiently.

Collect neighbor properties

Gather values already used by neighboring vertices.