R={VR}
VR={(v,w)|v,w∈V,(v,w)表示 v 和 w 之间存在直接
先修关系}
基本操作 P:
void CreatGraph(ALGraph *);
void FindInDegree(ALGraph , int * );
void TopologicalSort_1(ALGraph G,int numterm,int maxcredit);
void TopologicalSort_2(ALGraph G,int numterm,int maxcredit);
}ADT Graph
栈的定义:
ADT Stack{
数据对象:D={ai|ai∈ElemSet,i=1,2,…n,n>=0}
数据关系:R1={﹤ai-1 ai﹥|ai-1,ai∈D,i=2,…,n}
基本操作:
void InitStack (SqStack *S);
int StackEmpty(SqStack S);
void Push(SqStack *S, int );
int Pop(SqStack *S, int *e);
}ADT Stack
2. 主程序
int main() //主函数
{
int numterm; //学期总数
int uplcredit; //一个学期的学分上限