在829考试代码题中,完整写出数据结构定义是加分项。其中链表和二叉树的数据结构一定要烂熟于心。(基本上就是每年一道单链表、一道二叉树)
//单链表
typedef struct LNode{
int data;
struct LNode *next;
}LNode, *LinkList;
//二叉树-二叉链表
typedef struct BiTNode{
int data;
struct BiTNode *lchild,*rchild;
}BiTNode, *BiTree;
//二叉树-孩子兄弟
typedef struct BiTNode{
int data;
struct BiTNode *firstchild,*nextsibling;
}BiTNode, *BiTree;
//哈夫曼
typedef struct hfmTNode{
int symbol;
struct hfmTNode *left,*right;
}hfmTNode, *hfmTree;
//稀疏转置矩阵
typedef struct{
int row,col;
int value;
}Triple;
typedef struct{
Triple data[MAXSIZE+1];
int rows,cols,nums;
}TSMatrix;
//关键路径(ve/vl) 邻接表
typedef struct ArcNode{
int start,end,weight;
struct ArcNode *next;
};
typedef struct VNode{
struct ArcNode *firstarc;
int data;
};