A catalogue of constructions that recur across constructive problems.

Permutations

GoalConstruction
all distinct (alternate the ends)
No fixed points (derangement)shift by 1:
Adjacent elements differ by odd positions first, then even
all distinct mod (needs odd)
Maximum reverse the two halves
Every prefix sum distinct mod pattern
Exactly inversionssort, then reverse a suitable prefix and adjust
distinct adjacent differences

Alternating the extremes () is the single most reusable permutation construction — it maximises adjacent differences and separates values that must not be close.

Grids and matrices

GoalConstruction
Latin square
Two orthogonal Latin squares and , for odd
Magic square, odd the Siamese method (move up-right, drop down on collision)
All row and column sums equala circulant matrix
No two adjacent equalchessboard colouring
Every has all four valuestile with a fixed block
Fill so all rows/columns are distinct again

Sequences

GoalConstruction
All pairwise sums distinct (Sidon set)powers of 2, or -based
All subset sums distinct
Prefix sums all distinctstrictly positive values
No three in arithmetic progressionbase-3 digits avoiding 2 (the greedy/Stanley sequence)
Sum with distinct positives, then
Maximum gcd of a partitionmultiples of the intended gcd
All XOR-distincta linear basis

Graphs

GoalConstruction
Exactly edges, connecteda path plus extra edges
-regular grapha circulant: connect to
Bipartite with given degreesGale-Ryser condition, then greedy
Given degree sequenceErdős-Gallai condition, then Havel-Hakimi
Diameter exactly a path of length , everything else attached to the middle
Exactly componentsa clique of the right size plus isolated vertices
Tree with given degreesPrüfer code with the right multiplicities
Maximum edges, no trianglecomplete bipartite (Turán)
Maximum edges, no the Turán graph — a balanced -partite complete graph

Havel-Hakimi for realising a degree sequence: repeatedly take the highest-degree vertex, connect it to the next highest, decrement, and recurse.

Number-theoretic

GoalConstruction
numbers, pairwise coprimedistinct primes, or (Fermat numbers)
numbers with gcd and lcm scale a construction by
Sum , product solve the quadratic for ; use 1s to pad
disjoint bit sets ()
numbers with all subset sums distinctpowers of 2
Sum of distinct squaresgreedy from the largest
Prescribed remaindersCRT

is worth memorising — it appears constantly, and it is the statement that XOR is addition without carries.

The XOR toolbox

FactUse
has period 4 in prefix XOR in
pair up ranges to cancel
duplicate to cancel
Any values can be made to XOR to 0 by adding one elementthat element is their XOR
Consecutive pairs XOR to 1build a target XOR from pairs

The general recipes

  1. Alternate. High-low interleaving separates values.
  2. Pair up. Match with so pairs have a constant sum.
  3. Recurse. Solve or , then extend.
  4. Handle small separately. Most constructions have 2-3 exceptional cases.
  5. Use powers of two. They make sums and XORs independent.
  6. Use a shift or rotation. is a rich family.
  7. Colour or partition. Split by parity, residue, or a colouring.
  8. Be greedy from an extreme. Largest first, or most constrained first.

Always verify

Write the construction, then check it with a brute force on — including the exceptional cases. Constructions are easy to get almost right, and “almost” fails on exactly one test.

See also: Small Cases · General · Invariants