data abstraction preferences and the allowed operations on it?/FONT> mostpreferred, next preferred, prefers, read_preferences, and create_priorities

typedef int preferences[MAXN] [MAXN];

mostpreferred(person,pref) 

/* Returns the mate most

preferred by person as

specified by pref.

*/

int person;

preferences pref;

{

return(pref[person][1]);

}

nextpreferred(person,index,pref)

/* Returns the mate next most

preferred by person as specified

by pref.

*/

int person,index;

preferences pref;

{

return (pref[person][index]);

}

prefers(individual,person, individualsmate,priority)

/* Returns true only if individual prefers person

to the individual's mate as specified by priority.

*/

int individual,person,individualsmate;

preferences priority;

{

return(priority[individual][person]

< priority[individual][individualsmate]);

}

read_preferences(n,pref)

/* Reads n rows of

preferences into pref.

*/

int n;

preferences pref;

{

int i,j;

for(i=1;i<=n;i++)

for(j=1;j<=n;j++)

scanf("%d",&pref[i][j]);

}

create_priorities(n,pref,priority)

/* Creates n individual priorities in

priority based on the individual

preferences specified by pref.

*/

int n;

preferences pref,priority;

{

int i,j;

for(i=1;i<=n;i++)

for(j=1;j<=n;j++)

priority[i][pref[i][j]] = j;

}