Workspace Ordered Prefix
0d
Problem-solving patterns

Growing Sorted Region

Keep a known region sorted and extend its boundary one item or pass at a time.

Recognition signal

A sorting pass places an item in its final position or inserts it in an ordered run.

Method

Name the sorted region and show how it grows after one pass.

Worked example

Inserting 2 into [1, 5, 6] shifts 5 and 6 right before writing 2.

Common mistake

Adjacent elements may still be unordered outside the established region.