Skip to content

One pass [mp]

Micro pattern

Description

Produce a result in one ordered scan while maintaining the state needed for the processed prefix.

Problems

Maintain an optimum or reachability summary

Update the best answer and its supporting summary as each item arrives.

Maintain a window or balance

Update an active interval or scalar invariant as input advances.

Merge ordered objects

Compare each item with the last merged result.

Run-length processing

Consume each maximal equal-valued run once.

Two-ended scan

Move an active boundary on every iteration.

Streaming parsing

Finalize a token or term when its delimiter appears.

Monotonic stack scan

Resolve candidates when the current value establishes their boundary.