C-DAC C-CAT study materials
C-DAC C-CAT study resources

Five-Session Timetable with Ordering Constraints

C-DAC C-CAT · Put your knowledge to work in context.

All case studies

Five-Session Timetable with Ordering Constraints

Five training sessions -- P, Q, R, S, and T -- must be scheduled one per day from Monday to Friday. The coordinator has five constraints:

  • R cannot be on Monday.
  • Q must be before T.
  • S must be immediately after P.
  • T cannot be on Friday.
  • P cannot be on Wednesday.

No two sessions share a day. The coordinator wants to know every valid order before publishing the timetable. A colleague claims that the constraints allow only two orders, but that claim is not obviously correct. You need to reason from the constraints rather than guess. Each session has a fixed duration, but duration is irrelevant to the ordering. A single missed constraint can create an invalid schedule.

1. How many valid Monday-to-Friday schedules satisfy all five constraints? List them.

Read the worked answer

Treat P and S as a block PS because S is immediately after P. P cannot be Wednesday, so P is Monday, Tuesday, or Thursday (Friday would put S on Saturday). T cannot be Friday, and Q must precede T. Enumerate:

  • P=Mon, S=Tue. Remaining Q,R,T on Wed,Thu,Fri. T cannot Fri and Q<T, so Q=Wed, T=Thu, R=Fri. Schedule: P S Q T R.
  • P=Tue, S=Wed. Remaining Q,R,T on Mon,Thu,Fri. R not Mon; T not Fri. Q<T forces Q=Mon, T=Thu, R=Fri. Schedule: Q P S T R.
  • P=Thu, S=Fri. Remaining Q,R,T on Mon,Tue,Wed. Q<T; R not Mon. Options: Q=Mon,T=Tue,R=Wed; Q=Mon,T=Wed,R=Tue; Q=Tue,T=Wed,R=Mon is invalid because R is Monday. So two schedules: Q T R P S and Q R T P S.

Total: 4 valid schedules. The colleague's claim of only two is false.

2. If R is on Wednesday, what is the complete schedule? Show the deduction.

Read the worked answer

R=Wed. Since P cannot be Wed and S must immediately follow P, P cannot be Friday (no Saturday). Test P positions:

  • P=Mon gives S=Tue; remaining Q,T on Thu,Fri; T cannot Fri, so T=Thu, Q=Fri -- but Q must be before T, so this fails.
  • P=Tue gives S=Wed, but Wed is already R -- impossible.
  • P=Thu gives S=Fri; remaining Q,T on Mon,Tue; Q<T forces Q=Mon, T=Tue; R=Wed. Valid.

Thus the only schedule is Mon Q, Tue T, Wed R, Thu P, Fri S.

3. If T is on Tuesday, what schedule is forced? Explain.

Read the worked answer

T=Tue. Q must be before T, so Q=Mon. Remaining P,R,S occupy Wed,Thu,Fri. S must immediately follow P, and P cannot be Wed. The only possible P,S pair is P=Thu, S=Fri; P=Fri would need S=Sat, and P=Wed is banned. That leaves R=Wed. The forced schedule is Mon Q, Tue T, Wed R, Thu P, Fri S. It also satisfies R not Monday and T not Friday.