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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

NOTES ON DATA STRUCTURING 155<br />

However, it is also possible to deal with the two dimensi<strong>on</strong>s in a more<br />

symmetric fashi<strong>on</strong>, using a method based <strong>on</strong> the chained representati<strong>on</strong> of<br />

sequences. In this representati<strong>on</strong>, each actually used value of D 1 is placed<br />

in <strong>on</strong>e chain, and each actually used value of D2 is placed in another. These<br />

are called border chains. Each element of either border chain c<strong>on</strong>tains a<br />

base locati<strong>on</strong> pointing to a chained sequence of all elements with key values<br />

which fall into the class. Now each actual entry of the array has two addresses<br />

attached; <strong>on</strong>e points to the next item of the sequence which has the same<br />

classificati<strong>on</strong> according to D1, and the other to the next item which has the<br />

same classificati<strong>on</strong> according to D2. Thus each item may be pictured as<br />

residing <strong>on</strong> an intersecti<strong>on</strong> of the lines of a two-dimensi<strong>on</strong>al grid, with<br />

pointers leading across and downwards to the next item <strong>on</strong> the same r6w<br />

or the same column.<br />

" j<br />

], i<br />

• , r,<br />

i<br />

I d, ,I<br />

f ]<br />

I<br />

[d~,d2] i<br />

1<br />

[< ,dz]]<br />

i ........<br />

I !<br />

D 2 border chain Rest of this column Rest of :this column<br />

D2 border chain<br />

I Novolue of .......... Re~tofthis~o~<br />

A[d~ ,d~]<br />

I<br />

I~1 ' . t .......... Rest of this row<br />

FIo. 9. Grid Representati<strong>on</strong> of A : sparse array (dl ;D1 ;d2 :D2) of T<br />

This grid representati<strong>on</strong> is unfortunately suitable <strong>on</strong>ly when the entire<br />

structure will fit into main store. If the main part of the sequences have to be<br />

held <strong>on</strong> backing store, some sort of blocking of adjacent elements would be<br />

desirable in the interests of efficiency.<br />

11. EXAMPLE" EXAMINATION TIMETABLES<br />

In an educati<strong>on</strong>al establishment which offers students a wide choice of course<br />

combinati<strong>on</strong>s, there arises the problem of designing an examinati<strong>on</strong> time-<br />

table in which each examinati<strong>on</strong> is c<strong>on</strong>ducted in a single sessi<strong>on</strong>, and yet

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

Saved successfully!

Ooh no, something went wrong!