20.03.2013 Views

II. Notes on Data Structuring * - Cornell University

II. Notes on Data Structuring * - Cornell University

II. Notes on Data Structuring * - Cornell University

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

procedure gensupersets;<br />

NOTES ON DATA STRUCTURING<br />

begin e: exam; save 1, save 2: powerset exam;<br />

record; save 1 : = untried;<br />

if size (trial) < k then<br />

while untried ~ { ) do<br />

begin e from untried;<br />

end;<br />

end gensupersets.<br />

save 2: = untried /x incompat (e);<br />

untried: - save 2;<br />

trial: v {e);<br />

if sessi<strong>on</strong>count (trial) < hallsize then<br />

untried: v save 2;<br />

trial: - {e)<br />

untried: -- save 1<br />

gensupersets;<br />

The validity of this program depends <strong>on</strong> the fact that trial invariantly<br />

satisfies all c<strong>on</strong>diti<strong>on</strong>s (4) (5) and (6) for sessi<strong>on</strong>s of the timetable, as well as<br />

always being a subset of remaining.<br />

The reas<strong>on</strong>ing is as follows"<br />

for (4): gensupersets never generates a superset except when the size of the<br />

trial is strictly less than k.<br />

for (5): gensupersets is never entered when the sessi<strong>on</strong>count of trial is<br />

greater than the hall size (we assume that no examcount is greater than<br />

hallsize).<br />

for (6): removal of incompatible sets from untried ensures that at all<br />

times all exams remaining in untried are compatible with all exams of trial.<br />

Therefore, transfer of an arbitrary exam from untried to trial can never<br />

cause (6) to be violated.<br />

Finally, at the initial call of gensupersets, untried ~ remaining. Untried is<br />

an essentially n<strong>on</strong>-increasing quantity: every additi<strong>on</strong> of members to it has<br />

always been preceded by removal of those very same members. Untried is<br />

therefore always a subset of remaining; and trial, which is c<strong>on</strong>structed <strong>on</strong>ly<br />

from members of untried, must also always be a subset of remaining.<br />

This completes our first versi<strong>on</strong> of an abstract program to c<strong>on</strong>struct<br />

examinati<strong>on</strong> timetables. Collecting all the material together, it looks like this"<br />

161

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!