数据结构试题(华南理工大学)08级数据结构A卷答案.doc
文本预览下载声明
08级数据结构A卷参考答案
一、选择题(每题2分,共18分)
参考答案:
1、__D__ 2、_B___ 3、__B__ 4、__A__5、__C__ 6、__A__7、_D__ 8、_C___9、__B__
二、填空题(每题2分,共20分)
参考答案:
1、(c,d)
2、(1*1+2*2+4*3+1*4)/8=21/8
3、O(n1.5)
4、
5、
6、
选择边次序:(4,6)4 (4,3)6 (3,1)5 (6,5)9 (1,2)12
7、
8、dfebagc
9、xn+f(x,n-1) 或 1+x*f(x,n-1)
10、(q-rear - q-front + MaxSize)%MaxSize
三、计算题(每题6分,共30分)
1.
画树:4分
WPL=273 计算:2分
2.
0 1 2 3 4 5 6 7 8 9 10 33 41 30 1 20 24 13 67 哈希表:3分
计算:3分
3.
ASL = 11/4 计算:2分
画树:4分
4.
矩阵:2分
邻接表:2分
强连通分量:2分
5. next计算:2分 nextval计算:2分 匹配过程:2分
j 0 1 2 3 4 5 模式t a b a b A a next[j] -1 0 0 1 2 3 nextval[j] -1 0 -1 0 -1 3 s= a b b a b a b a a b i=2, j=2时,不匹配,此时,j=nextval[2]= -1
t = a b a b a a 则 i=2+1=3, j=0, 继续
s=a b b a b a b a a b 当i=9, j=6时,匹配成功,
t= a b a b a a Index(s,t) = i-j = 9-6=3
四、每空2分,共12分
(A) s-data[s-top] = x (B) q-front = (q-front+1)%MaxSize
(C) cout h-data (D) DisPList ( h-next)
(E) DFS ( G, p-adjvex) (F) p-nextarc
五、每题10分,共20分
1. 1) typedef struct node 2分
{ int data;
struct node *next;
} LinkList;
2) int CreateListR ( LinkList *L ) 函数头定义:1分
{ LinkList *s, *r;
int x,n=0;
L = new LinkList; // or: L=(LinkList *)malloc(sizeof(LinkList)); 头结点:0.5分
r = L;
cin x;
while (x!=0) 有循环: 1分
{ s=new LinkList; // or: s=(LinkList *)m
显示全部