Advanced Study Notes – Seating Arrangement
For the Andhra Pradesh Patwari / Lekhpal Examination
(Reasoning Ability – “Seating Arrangement”)
Objective – Transform a verbal description of relative positions into a unique, provable seating layout.
Approach – Treat the layout as a Constraint Satisfaction Problem (CSP), apply combinatorial reasoning, and use algorithmic insights (graph‑theory, backtracking, SAT) for rigorous proofs.
1. First‑Principle Representation
| Symbol | Meaning | Example |
|---|---|---|
P |
Person | A, B, … |
S[i] |
Seat index (1‑based) | S[1] … S[n] |
pos(P) |
Seat occupied by P |
pos(A) = 3 |
adjacent(P,Q) |
` | pos(P) – pos(Q) |
left_of(P,Q) |
pos(P) < pos(Q) |
left_of(A,D) |
right_of(P,Q) |
pos(P) > pos(Q) |
right_of(C,A) |
distance(P,Q)=k |
` | pos(P) – pos(Q) |
Key Principle – Every verbal constraint can be converted into an equational or inequality over the
posvariables.
The task reduces to solving these equations/inequalities under the global constraint that every pos(P) is a distinct integer in {1,…,n}.
2. Fundamental Constraint Types
| Type | Formalisation | Typical Example | Notes |
|---|---|---|---|
| Adjacency | ` | pos(P) – pos(Q) | = 1` |
| Order | pos(P) < pos(Q) |
“C is to the left of D” | Strict; cannot be equal. |
| Distance | ` | pos(P) – pos(Q) | = k` |
| Group | pos(P) ∈ {i1,i2,…} |
“A sits in seat 2 or 5” | Range or specific set. |
| Parity | pos(P) even/odd |
“B occupies an even‑numbered seat” | Useful for symmetry arguments. |
| Exclusion | pos(P) ≠ i |
“C does not sit in seat 3” | Often used with “not” clauses. |
| Relative Distance | pos(P) – pos(Q) = k |
“G is three seats to the right of H” | Directional; sign matters. |
Rule of Thumb – Combine constraints to create a tight system; the more relationships, the fewer permutations remain.
3. Advanced Theoretical Tools
3.1 Graph‑Theoretic Modelling
- Vertices – Persons.
- Edges – Constraints between two persons.
- Adjacency edge annotated with
±1. - Distance edge annotated with
k.
- Adjacency edge annotated with
Goal – Find a Hamiltonian path (linear arrangement) that satisfies all edge labels.
If the graph is connected and all edge labels are consistent, a unique ordering often results.
3.2 Constraint Satisfaction Problem (CSP)
- Variables –
pos(P)for each person. - Domains –
{1,…,n}. - Constraints – As listed in Section 2.
Solve via backtracking, forward‑checking, or arc‑consistency (AC‑3).
Why CSP?
- Guarantees soundness – every solution satisfies all constraints.
- Provides a systematic search strategy.
- Can be encoded into SAT (Boolean satisfiability) for automatic solving.
3.3 Combinatorial Counting
When the problem asks how many arrangements satisfy the constraints:
- Fix the relative order of a subset (e.g., if
Amust be left ofB, treat them as a single block). - Count permutations of the remaining free seats.
- Apply inclusion–exclusion if constraints overlap.
4. Edge Cases & Pitfalls
| Edge Case | Issue | How to Resolve |
|---|---|---|
| Circular Table | Distances wrap around. | Use modulo arithmetic: distance(P,Q)=k → `min( |
| Multiple Valid Positions | Ambiguity if constraints are weak. | Check for symmetry: reflect the arrangement; if both satisfy constraints, answer is not unique. |
| Contradictory Constraints | E.g., pos(A)=2 and pos(A)=3. |
Detect early via domain pruning; no solution → “No such arrangement”. |
| Adjacent but Not Specific Order | “A sits next to B” but not specifying left/right. | Consider both possibilities; if both lead to valid layouts, answer is not unique. |
| Distance Zero | “A sits in the same seat as B” impossible unless same person. | Recognise as invalid; reject. |