大学数据结构考试题和答案.pdf
《大学数据结构考试题和答案.pdf》由会员分享,可在线阅读,更多相关《大学数据结构考试题和答案.pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、第 1 章 绪论1、填空题1.常见的数据结构有_线性 _结构,_树形 _结构,_图形 _结构等三种。2.常见的存储结构有_顺序存储 _结构,_链式存储 _结构等两种。3.数据的基本单位是_数据元素 _,它在计算机中是作为一个整体来处理的。4.数据结构中的结构是指数据间的逻辑关系,常见的结构可分为两大类,_线性结构_和_非线性结构 _。2、应用题1、给出以下算法的时间复杂度.void fun(int n)int i=1,k=100;while(in)k=k+1;i=i+2;时间复杂度为_O(n)_。2、给出以下算法的时间复杂度.void fun2(int n)int i=1,k=100;whil
2、e(inext=p-next_;_p-next=s _;4.在单向链表中,若要删除某个结点p,一般要找到 _p 的前趋 _结点,才能实现该操作。2、选择题1.将两个各有n 个元素的有序表归并成一个有序表,其最少的比较次数是A。(A)n (B)2n 1(C)2n (D)n-1 2.在单链表中,如果在结点p 之后插入一个新结点s,其操作为 A。(A)s-next=p-next;p-next=s;(B)p-next=s;s-next=p-next;(C)s-next=p;p-next=s-next;(D)p-next=s;s-next=p;3.若长度为n 的线性表采用顺序存储结构,在其第i 个位置删
3、除一个元素的算法的平均时间复杂度为(C)。(1i n)AO(0)BO(1)C.O(n)D O(n2)4.若长度为n 的线性表采用顺序存储结构,在其第i 个位置插入一个新元素需要移动的元素个数为(B)。(1i n+1)An-i Bn-i+1 C.i Dn-i-1 3、判断题1.线性表中每一个元素都有一个前驱和一个后继。()4、程序设计题1、单链表的结点结构定义如下:struct LinkNode 文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T
4、5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文
5、档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T
6、5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文
7、档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T
8、5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文
9、档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T
10、5B7Y4A6 ZY8R3B8L7K1 LinkNode*next;int data;请根据述函数的功能写程序。void Insert(LinkNode*h,LinkNode*s)/h指向链表的头结点(即使链表中没有元素,头结点也存在。)/链表中元素已经递增有序/函数功能为将结点s 插入到链表h 中。插入后链表仍然保持递增的顺序LinkNode*p,*q;/q指向 p 的前驱q=h;p=h-next;while(p)if(p-datas-data)/寻找到插入点位置,插入s q-next=s;s-next=p;return;else q=p;(1分)p=p-next;(1分)/当表中没有比s
11、大的结点时,插入到表尾s-next=q-next;(2分)q-next=s;(2分)2、设顺序表L 是一个递增有序表,试写一算法,将x 插入 L 中,并使L 仍是一个有序表。顺序表的结构定义如下:#define ListSize 100 /假定表空间大小为100 struct SqList int elemListSize;/数组 elem 用于存放表中的数据int length;/当前的表长度;/以上为顺序表的结构/函数头定义如下void InsertIncreaseList(SqList&L,int x)int i;if(L.length=ListSize)cout0&L.elem i-1
12、 x;i-)L.elem i=L.elem i-1 ;/比较并移动元素文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y
13、4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:
14、CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y
15、4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:
16、CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y
17、4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:
18、CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1L.elem i =x;/插入 x L.length+;/表长增 1 /3、单链表中结点的结构如下所示:typedef struct node int data;struct node*next;node;请设计满足下述功能的函数。要求:建立带头结点的单链表H,要求函数从屏幕上读入m个整数
19、,每读入一个,便生成相应的结点,并且把它插入到链表H 的尾部。函数形式为void CreateLinkList(node*H)。参考程序:void CreateList(node*H)/H指向头指针int m,temp;coutm;/int i=1;node*tail;H-next=NULL;tail=H;while(i=m)coutplease input your number:temp;node*t=new node;t-data=temp;t-next=tail-next;tail-next=t;tail=t;i+;第 3 章 栈和队列1、填空题1.栈和队列在本质上都是_线性表 _。2
20、.栈的操作特点是_后进先出 _。队列的操作特点是_先进先出 _。2、选择题1.消除递归不一定需要使用栈,此说法_A_。A.正确 B.错误文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8
21、R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3
22、O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8
23、R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3
24、O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8
25、R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3O9E8 HW7T5B7Y4A6 ZY8R3B8L7K1文档编码:CT2H4S3
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 大学 数据结构 考试题 答案
限制150内