数据结构练习题2012-2013


insertion sort. When 2 is moved to the first position, the number 8
must be at position (start from 1)
.
a. 4
b. 5
c. 6
d. 7
(10) Let T be a tree of N nodes created by union-by-height without path compression, then the depth of the tree is
but stacks cannot d. Stacks and queues are linear structures while lists are not
(5) For an in-order threaded binary tree, if the pre-order and inorder traversal sequences are ABCDEF and CBAEDF respectively,which pair nodes’ right links are both threads?
a. E
b. 2E
c. N2-E
d. N2-2E
(8) If a directed graph is stored by an upper-triangular adjacency
matrix –- that is, all the elements below the main diagonal are zero.
浙江大学 2012–2013 学年秋学期
《数据结构基础》课程期末考试试卷(A)
课程号: 211C0020_,开课学院:_计算机科学与技术_ 考试试卷:√A 卷、B 卷(请在选定项上打√) 考试形式:√闭、开卷(请在选定项上打√),允许带____无___入场 考试日期: 2012 年 11 月 15 日,考试时间: 120 分钟
Then its topological order
.
a. exists and must be unique
b. exists but may not be unique
c. does not exist
d. cannot be determined
(9) Sort a sequence of nine integers {4, 8, 3, 7, 9, 2, 10, 6, 5} by
}
} while (flag_swap > 0);
return h;
}
(2) The function is to perform Find as a Union/Find operation with
path compression. (9 points)
SetType Find ( ElementType X, DisjSet S )
struct node *p, *q; int flag_swap;
if (!h->next) return h;
do{
flag_swap = 0;
p = h;
while (p->next->next){
if (
){
flag_swap++;
q = p->next;

;

;

;
}
else p = p->next;
1. (a)
(b)
2. (a) (b) (c)
3. (a)
(b)
4. i 0 1 2 3 4 5 6 7 8 9 10 11 12
H[i]
5.
(a)
(b)
(c)
Part IV (15)
typedef struct TreeNode *Tree; struct TreeNode {
Tree Child; int key; Tree Sibling; }; int Counter[MAX_LEVEL] ; /* Counter[i] stores the number of leaves on the i-th level.*/ /* The root is on the level 0. */ void Count_Leaves( Tree T )
v1
3
v2 ∧
v3
4
v4 ∧
v5
2
2 5∧ 4
4∧ 1∧
(3) A binary search tree is said to be of “type A” if all the keys along the path from the root to any leaf node are in sorted order (either ascending or descending).
pN. If p2 = 2, then pi (i>2) must be
.
a. i
b. i+2
c. N - i d. cannot be determined
(4) What is the major difference among lists, stacks, and queues?
a. Lists use pointers, and stacks and queues use arrays b. Stacks and queues are lists with insertion/deletion constraints c. Lists and queues can be implemented using circularly linked lists,
(1) Bubble sort is a simple sorting algorithm. Suppose we have a list of integers and want to sort them in ascending order. Bubble sort repeatedly scans the list from the head to the tail, and swaps two adjacent numbers if they are in the wrong order. Please complete the following program to implement bubble sort. (12 points)
诚信考试,沉着应考,杜绝违纪。
考生姓名:
学号:
所属院系:
_
题序




总分
得分
评卷人
1.
2.
6.
7.
1.
_ _ _ _
Answer Sheet
Part I (20)
3.
4.
5.
8.
9.
10.
Part II (21)
_____
_
_____ ____ _
2. _
_
__
___
Part III (44)
.
a. N-1
b. N
c. N(N+1)/2
d. N+1
(7) If an undirected graph with N vertices and E edges is represented
by an adjacency matrix. How many zero elements are there in the matrix?
struct node{ int value; struct node *next; /* some other fields */
}
struct node BubbleSort (struct node *h) {/* h is the head pointer of the list with a dummy head node */
(b) Is Quick Sort stable? Please give a proof if your answer is “YES”, else please provide a counter example. (4 points)
(2) Given the adjacency list representation of a directed graph. Suppose V1 is always the first vertex being visited. Please list
d. N grows faster than N (log N )2
(2) What is the time complexity of the following function computes XN?
long int Pow (long int X, unsigned int N) { if (N == 0) return 1; if (N == 1) return X; if (IsEven(N)) /* IsEven(N) returns 1 if N is even, or 0 otherwise */ return Pow(X, N / 2) * Pow (X, N / 2); else return Pow(X * X, N / 2) * X;
}
that
a. O( N )
b. O( log N )
c. O( N log N )
d. O( N )
(3) Suppose that N integers are pushed into and popped out of a stack.
The input sequence is 1, 2, …, N and the output sequence is p1, p2, …,
合集下载

数据结构真题2012年10月

数据结构真题2012年10月

数据结构真题2012年10月(总分:100.00,做题时间:90分钟)一、单项选择题(总题数:15,分数:30.00)1.一个算法的时间耗费的数量级称为该算法的______(分数:2.00)A.效率B.难度C.可实现性D.时间复杂度√解析:[考点] 算法的时间复杂度的概念[解析] 一个算法的时间耗费的数量级称为该算法的时间复杂度。

2.顺序表便于______(分数:2.00)A.插入结点B.删除结点C.按值查找结点D.按序号查找结点√解析:[考点] 顺序表的特征[解析] 顺序表便于按序号查找结点。

3.设带头结点的单循环链表的头指针为head,指针变量P指向尾结点的条件是______(分数:2.00)A.p->next->next==headB.p->next==head √C.p->next->next==NULLD.p->next==NULL解析:[考点] 指针变量p指向尾结点的判定条件[解析] 单循环链表的指针变量p指向尾结点的判定条件是p->next==head。

4.设以数组A[0..m-1]存放循环队列,front指向队头元素,rear指向队尾元素的下一个位置,则当前队列中的元素个数为______(分数:2.00)A.(rear-front+m)%m √B.rear-front+1C.(front-rear+m)%mD.(rear-front)%m解析:[考点] 队列中元素个数的计算[解析] 队列中元素的个数为(rear-front+m)%m5.下列关于顺序栈的叙述中,正确的是______(分数:2.00)A.入栈操作需要判断栈满,出栈操作需要判断栈空√B.入栈操作不需要判断栈满,出栈操作需要判断栈空C.入栈操作需要判断栈满,出栈操作不需要判断栈空D.入栈操作不需要判断栈满,出栈操作不需要判断栈空解析:[考点] 顺序栈的性质的判断[解析] 入栈操作需要判断栈满,出栈操作需要判断栈空。

6.A是一个10×10的对称矩阵,若采用行优先的下三角压缩存储,第一个元素a 0,0的存储地址为1,每个元素占一个存储单元,则a 7,5的地址为______(分数:2.00)A.25B.26C.33D.34 √解析:[考点] 对称矩阵的元素的地址的计算[解析] 若对称矩阵采用下三角压缩存储,根据其地址的计算公式,可得到所求元素的地址。

2012年数据结构期末考试题及答案

2012年数据结构期末考试题及答案

2012年数据结构期末考试题及答案一、选择题1.在数据结构中,从逻辑上可以把数据结构分为C。

A.动态结构和静态结构B.紧凑结构和非紧凑结构C.线性结构和非线性结构D.内部结构和外部结构2.数据结构在计算机内存中的表示是指A。

A.数据的存储结构B.数据结构C.数据的逻辑结构D.数据元素之间的关系3.在数据结构中,与所使用的计算机无关的是数据的A结构。

A.逻辑B.存储C.逻辑和存储D.物理4.在存储数据时,通常不仅要存储各数据元素的值,而且还要存储C。

A.数据的处理方法B.数据元素的类型C.数据元素之间的关系D.数据的存储方法5.在决定选取何种存储结构时,一般不考虑A。

A.各结点的值如何B.结点个数的多少C.对数据有哪些运算D.所用的编程语言实现这种结构是否方便。

6.以下说法正确的是D。

A.数据项是数据的基本单位B.数据元素是数据的最小单位C.数据结构是带结构的数据项的集合D.一些表面上很不相同的数据可以有相同的逻辑结构7.算法分析的目的是C,算法分析的两个主要方面是A。

(1)A.找出数据结构的合理性B.研究算法中的输入和输出的关系C.分析算法的效率以求改进C.分析算法的易读性和文档性(2)A.空间复杂度和时间复杂度B.正确性和简明性C.可读性和文档性D.数据复杂性和程序复杂性8.下面程序段的时间复杂度是O(n2)。

s =0;for(I =0;i<n;i++)for(j=0;j<n;j++)s +=B[i][j];sum =s ;9.下面程序段的时间复杂度是O(n*m)。

for(i =0;i<n;i++)for(j=0;j<m;j++)A[i][j] =0;10.下面程序段的时间复杂度是O(log3n)。

i =0;while(i<=n)i =i * 3;11.在以下的叙述中,正确的是B。

A.线性表的顺序存储结构优于链表存储结构B.二维数组是其数据元素为线性表的线性表C.栈的操作方式是先进先出D.队列的操作方式是先进后出12.通常要求同一逻辑结构中的所有数据元素具有相同的特性,这意味着 B 。

《数据结构》2012-2013试卷B

《数据结构》2012-2013试卷B

m-i+1
。(4 分)
9、用邻接矩阵存储包含 30 个顶点和 35 条边的有向图,则该邻接矩阵中的元素个数
为 900
,零元素个数为
865
。(4 分)
二、 应用题(32 分)
1、 若一棵度为 m 的树中有 n(1)个度为 1 的节点,n(2)个度为 2 的节点,n(3) 个度为 3 的节点,…,n(m)个度为 m 的节点,问该树有多少个叶节点? (9 分)

非线性结构
。(4 分)
2、在 n 个元素的顺序表中插入一个元素,需要最多移动 n
移动的元素个数与插入的元素的位子
有关。(4 分)
元素,具体
3、从循环队列中插入一个元素时,其操作是先 插入元素 ,后 移动队首指 针 。(4 分)
4、设 S=”h:/美的 Mary.doc”,则 strlen(s)= 15 6 。(4 分)
第 5 步(1 分)
其带权路径长度=(2*16+3*(7+8+10+12+14)+4*6+5*(3+3))/79≈3.02532
4、 给出一组关键字(12,13,17,14,6,1,13,6)进行堆排序,试列出每 一趟排序后关键字的排列次序,并比较每遍排序所进行的关键字比较次数。(7 分) 解:
解:(7 分) (1)初始化之前
试卷类别(A、B、C):[ B ] 共 3 大题
温馨提示
请考生自觉遵守考试纪律,争做文明诚信的大学生。如有违犯考试纪律,将严格 按照《江西理工大学学生违纪处分暂行规定》处理。
班级
学号
姓名
十十
题号 一 二 三 四 五 六 七 八 九 十
总分

2012-2013数据结构

2012-2013数据结构

浙江大学2012–2013学年秋学期《数据结构基础》课程期末考试试卷(A) 课程号: 211C0020_,开课学院:_计算机科学与技术_考试试卷:√A卷、B卷(请在选定项上打√)考试形式:√闭、开卷(请在选定项上打√),允许带____无___入场考试日期: 2012 年 11 月 15 日,考试时间: 120 分钟诚信考试,沉着应考,杜绝违纪。

考生姓名:学号:所属院系: _Answer SheetNOTE: Please write your answers on the answer sheet.注意:请将答案填写在答题纸上。

I. Please select the answer for the following problems. (20 points)(1) Which one of the following statements is true as N grows?a. For any x , N x grows faster than !Nb. 2)(log N grows faster than Nc. 2log N grows faster than 2)(log Nd. N grows faster than 2)(log N N(2) What is the time complexity of the following function that computes X N ?long int Pow (long int X, unsigned int N) {if (N == 0) return 1;if (N == 1) return X;if (IsEven(N)) /* IsEven(N) returns 1 if N is even, or 0 otherwise */return Pow(X, N / 2) * Pow (X, N / 2);else return Pow(X * X, N / 2) * X;} a. O(N ) b. O(N log ) c. O(N N log ) d. O(N )(3) Suppose that N integers are pushed into and popped out of a stack. The input sequence is 1, 2, …, N and the output sequence is p 1, p 2, …, p N . If p 2 = 2, then p i (i>2) must be .a. ib. i+2c. N - id. cannot be determined(4) What is the major difference among lists, stacks, and queues? a. Lists use pointers, and stacks and queues use arraysb. Stacks and queues are lists with insertion/deletion constraintsc. Lists and queues can be implemented using circularly linked lists, but stacks cannotd. Stacks and queues are linear structures while lists are not(5) For an in-order threaded binary tree, if the pre-order and in-order traversal sequences are ABCDEF and CBAEDF respectively ,which pair nodes ’ right links are both threads?a. A and Bb. B and Dc. C and Dd. B and E(6) If N keys are hashed into the same slot, then to find these N keys, the minimum number of probes with linear probing is .a. N-1b. Nc. N(N+1)/2d. N+1(7) If an undirected graph with N vertices and E edges is represented by an adjacency matrix. How many zero elements are there in the matrix? a. E b. 2E c. N 2-E d. N 2-2E(8) If a directed graph is stored by an upper-triangular adjacency matrix –- that is, all the elements below the main diagonal are zero. Then its topological order .a. exists and must be uniqueb. exists but may not be uniquec. does not existd. cannot be determined(9)Sort a sequence of nine integers {4, 8, 3, 7, 9, 2, 10, 6, 5} by insertion sort. When 2 is moved to the first position, the number 8 must be at position (start from 1) .a. 4b. 5c. 6d. 7(10)Let T be a tree of N nodes created by union-by-height without path compression, then the depth of the tree isa. N/2b. O(logN)c. O(N2)d. O(1)II. Given the function descriptions of the following two (pseudo-code) programs, please fill in the blank lines. (21 points)(1)Bubble sort is a simple sorting algorithm. Suppose we have a list of integers and want to sort them in ascending order. Bubble sort repeatedly scans the list from the head to the tail, and swaps two adjacent numbers if they are in the wrong order. Please complete the following program to implement bubble sort. (12 points)struct node{int value;struct node *next;/* some other fields */}struct node BubbleSort (struct node *h){/* h is the head pointer of the list with a dummy head node */struct node *p, *q;int flag_swap;if (!h->next) return h;do{flag_swap = 0;p = h;while (p->next->next){if (① ){flag_swap++;q = p->next;② ;③ ;④ ;}else p = p->next;}} while (flag_swap > 0);return h;}(2)The function is to perform Find as a Union/Find operation with path compression. (9 points)SetType Find ( ElementType X, DisjSet S ){ElementType root, trail, lead;for ( root = X; S[ root ] > 0; ① );for ( trail = X; trail != root; ② ) {lead = S[ trail ] ;③ ;}return root ;}III. Please write or draw your answers for the following problems on the answer sheet. (44 points)(1) A sorting algorithm is stable if for any keys K i = K j for i < j,the corresponding records R i precedes R j in the sorted list.(a)Is Heap Sort stable? Please give a proof if your answer is“YES”, else please provide a counter example. (4 points)(b)Is Quick Sort stable? Please give a proof if your answer is“YES”, else please provide a counter example. (4 points)(2)Given the adjacency list representation of a directed graph.Suppose V1 is always the first vertex being visited. Please list(a)the depth-first search sequence; (5 points)(b)the breath-first search sequence; (5 points) and(c)the strongly connected components. (3 points)(3) A binary search tree is said to be of “type A”if all the keysalong the path from the root to any leaf node are in sorted order(either ascending or descending).(a)Given four keys {1, 2, 3, 4}, please draw all the possiblebinary search trees of type A. (4 points)(b)In general, given N keys {1, 2, …, N}, how many differentbinary search trees of type A can be constructed? (3 points)(4)Given a hash table of size 13 and the hash function H(key) = keymod 13. Assume that quadratic probing is used to solve collisions.Please fill in the hash table with input numbers {2, 15, 3, 16, 6,29, 24, 28}. (4 points)(5)Given eight keys {1, 2, …, 8}. Please do the following:(a)construct a complete binary tree which is also a binary searchtree; (5 points) and(b)construct a min-heap out of the array which stores thecomplete binary tree obtained from (a). Use BuildHeap with asequence of percolate-down’s. (4 points)(c)Observe the keys on each level of the min-heap obtained from(b). Is there a pattern of ordering? Is this true for moregeneral cases? (3 points)IV. Given a tree represented by left-child-right-sibling structure, please describe an algorithm that counts the number of leaf nodes on every level.(15 points)。

(完整版)数据结构练习题及参考答案

(完整版)数据结构练习题及参考答案

数据结构练习题第一部分绪论一、单选题1. 一个数组元素a[i]与________的表示等价。

A、 *(a+i)B、 a+iC、 *a+iD、 &a+i2. 对于两个函数,若函数名相同,但只是____________不同则不是重载函数。

A、参数类型B、参数个数C、函数类型3. 若需要利用形参直接访问实参,则应把形参变量说明为________参数A、指针B、引用C、值4. 下面程序段的时间复杂度为____________。

for(int i=0; i<m; i++)for(int j=0; j<n; j++)a[i][j]=i*j;A、 O(m2)B、 O(n2)C、 O(m*n)D、 O(m+n)5. 执行下面程序段时,执行S语句的次数为____________。

for(int i=1; i<=n; i++)for(int j=1; j<=i; j++)S;A、 n2B、 n2/2C、 n(n+1)D、 n(n+1)/26. 下面算法的时间复杂度为____________。

int f( unsigned int n ) {if ( n==0 || n==1 ) return 1; else return n*f(n-1);}A、 O(1)B、 O(n)C、 O(n2)D、 O(n!)二、填空题1. 数据的逻辑结构被分为__________、_________、__________和__________四种。

2. 数据的存储结构被分为__________、_________、__________和__________四种。

3. 在线性结构、树形结构和图形结构中,前驱和后继结点之间分别存在着________、________和________的联系。

4. 一种抽象数据类型包括__________和__________两个部分。

5. 当一个形参类型的长度较大时,应最好说明为_________,以节省参数值的传输时间和存储参数的空间。

2012年数据结构本科试题及答案

2012年数据结构本科试题及答案

武汉大学计算机学院2012年-2013学年第一学期“数据结构”考试试题(A )姓名学号(序号)_ 班号要求:所有的题目的解答均写在答题纸上,需写清楚题目的序号。

每张答题纸都要写上姓名和序号。

一、单项选择题(每小题2分,共30分)1. 数据结构在计算机内存中的表示是指 。

A. 数据的存储结构 B. 数据结构 C. 数据的逻辑结构 D. 数据元素之间的关系2. 若线性表最常用的运算是存取第i 个元素及其前趋元素的值,则采用 存储方式节省时间。

A.单链表B.双链表C.单循环链表D.顺序表3. 在一个具有n 个结点的有序单链表中插入一个新结点使得仍然有序,其算法的时间复杂度为 。

A.O(log 2n)B.O(1)C.O(n 2)D.O(n) 4. 栈和队列的共同点是 。

A.都是先进后出 B.都是先进先出 C.只允许在端点处插入和删除元素 D.没有其同点5. 判定一个循环队列Q (存放元素位置为0~QueueSize-1,front 指向队中队首元素的前一个位置,rear 指向队中队尾元素的位置)队空的条件是 。

A.Q.front==Q.rearB.Q.front+1==Q.rearC.Q.front==(Q.rear+1)%QueueSizeD.Q.rear==(Q.front+1)%QueueSize 6. 串是 。

A.不少于一个字母的序列B.任意个字母的序列C.不少于一个字符的序列D.有限个字符的序列 7. 一个n×n 的对称矩阵A ,如果采用以列优先(即以列序为主序)的压缩方式存放到一个一维数组B 中,则B 的容量为 。

A. n 2B.22nC. 2)1(+n nD.2)1(2+n8. 若一棵3次树中有a 个度为1的节点,b 个度为2的节点,c 个度为3的节点,则该树中有 个叶子节点。

A.1+2b +3cB.a +2b +3cC.2b +3cD.1+b +2c 9. 一棵完全二叉树中有501个叶子节点,则至少有 个节点。

数据结构复习题及答案(12级)

一、选择题。

(每小题2分,共40分)(1) 计算机识别.存储和加工处理的对象被统称为____A____。

A.数据B.数据元素C.数据结构D.数据类型(2) 数据结构通常是研究数据的____ A _____及它们之间的联系。

A.存储和逻辑结构B.存储和抽象C.理想和抽象D.理想与逻辑(3) 不是数据的逻辑结构是____ A ______。

A.散列结构B.线性结构C.树结构D.图结构(4) 数据结构被形式地定义为<D,R>,其中D是____ B _____的有限集,R是____ C _____的有限集。

A.算法B.数据元素C.数据操作D.逻辑结构(5) 组成数据的基本单位是____ A ______。

A.数据项B.数据类型C.数据元素D.数据变量(6) 设数据结构A=(D,R),其中D={1,2,3,4},R={r},r={<1,2>,<2,3>,<3,4>,<4,1>},则数据结构A是____ A ______。

A.线性结构B.树型结构C.图型结构D.集合(7) 数据在计算机存储器内表示时,物理地址与逻辑地址相同并且是连续的,称之为___ C ____。

A.存储结构B.逻辑结构C.顺序存储结构D.链式存储结构(8) 在数据结构的讨论中把数据结构从逻辑上分为___ A ____。

A.内部结构与外部结构B.静态结构与动态结构C.线性结构与非线性结构D.紧凑结构与非紧凑结构(9) 对一个算法的评价,不包括如下____ B _____方面的内容。

A.健壮性和可读性B.并行性C.正确性D.时空复杂度(10) 算法分析的两个方面是__ A ____。

A.空间复杂性和时间复杂性B.正确性和简明性C.可读性和文档性D.数据复杂性和程序复杂性(11) 线性表是具有n个___ C _____的有限序列(n≠0)。

A.表元素B.字符C.数据元素D.数据项(12) 线性表的存储结构是一种____ B ____的存储结构。

中国海洋大学2012-2013学年期末考试试题及参考答案

中国海洋大学2012-2013学年期末考试试题及参考答案2012-2013学年第 2 学期试题名称:数据结构专业年级:计算机学号姓名授课教师名分数一、解答下列各题(40 分,每小题 8 分)1.画出广义表L=(a,(( ),b),(((e)))) 的存储结构图,并利用取表头和取表尾的操作分离出原子e。

2.对下图所示有向图,利用Dijkstra算法求出从顶点A到其它各顶点的最短路径及距离。

B 10 E23015A 4 D 10154C 10 F3. 已知一棵3阶B-树如图一所示。

图一①画出插入(18)后的3阶B-树;②画出在插入(18)后的3阶B-树中删除(78)后的3阶B-树。

4. 给出一组关键字(12,2,16,30,8,28,4,10,20,6,18),按从小到大顺序,写出对其进行希尔排序(排序的间隔增量为5、2、1)的排序过程。

5. 从空树开始,按下列插入顺序:DEC、FEB、NOV、OCT、JUL、SEP、AUG、APR、MAR、MAY、JUN、JAN,给出最终所得到的二叉平衡树。

二、判断题:正确的打√,错误的打×(每题1分,共15分)1.在具有头结点的链式存储结构中,头指针指向链表中的第一个数据结点。

()2.在单链表中,要访问某个节点,只要知道该结点的指针即可:因此,单链表是一种随机存取结构。

()3.顺序存储结构属于静态结构,链式结构属于动态结构。

()4.广义表是线性表的推广,是一类线性数据结构。

()5.线性表可以看成是广义表的特例,如果广义表中的每个元素都是原子,则广义表便成为线性表。

()6.广义表中原子个数即为广义表的长度。

()7.用树的前序遍历和中序遍历可以导出树的后序遍历。

()8.哈夫曼树是带权路径长度最短的树,路径上权值较大的结点离根较近。

()9.二叉树中不存在度大于2的结点,当某个结点只有一棵子树时,无所谓左、右子树之分。

()10.若连通图上各边权值均不相同,则该图的最小生成树是唯一的。

2012-2013数据结构试题12050841

2012-2013 学年第2 学期末考试试题(A卷)课程名称计算机程序设计基础__________使用班级:12050841 _______、判断题(共20 分每小题2 分)1不论是入队操作还是入栈操作,在顺序存储结构上都需要考虑“溢出”情况。

()2当向二叉排序树中插入一个结点,则该结点一定成为叶子结点。

()3完全二叉树中的叶子结点只可能在最后两层中出现。

()4哈夫曼树中没有度数为1的结点。

()5对连通图进行深度优先遍历可以访问到图中的所有顶点。

()6先序遍历一查二叉排序树一定可以得到一个有序序列。

()7线性表中的所有元素都有一个前驱元素和一个后继元素。

()8满二叉树一定是完全二叉树,完全二叉树不一定是满二叉树。

()9调用一次深度优先遍历算法可以访问到图中的所有顶点。

()10栈和队列的共同特点是只允许在表的一端进行插入和删除操作。

二、运算题(共40分)1请根据你的理解,给出数据结构的定义。

(6分)2请给出稀疏矩阵的概念,举一实例,并给出此实例的三元组表示。

(10分)3有6个元素A B、C D E F一次进栈,允许任何时候出栈,能否得到下列的每个出栈序列, 若能,给出栈操作的过程,若不能,简述其理由。

(10分)(1) CDBEFA (2)ABEDFC (3)DCEABF (4)BAEFCD4 一个AOV网的二元组表示为:V={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}E={<0,2>,<0,4>,<1,2>,<1,5>,<2,4>,<3,5>,<4,6>,<4,7>,<5,7>,<6,8>,<7,6>,<7,8>,<7,9>,<8,10>,<9,10>}在此AOV网的邻接表存储中,若各顶点邻接表中的边接结点是按照邻接顶点序号从大到小链接的,请写出按此邻接表和介绍的拓扑排序算法得到的拓扑序列。

2012数据结构题

●__(4)__的特点是数据结构中元素的存储地址与其关键字之间存在某种映射关系。

(4)A.树形存储结构B.链式存储结构C.索引存储结构D.散列存储结构●若循环队列以数组 Q[O..m-1] 作为其存储结构变量 rear 表示循环队列中队尾元素的实际位置,其移动按 rear=(rear+1) mod m 进行,变量 length 表示当前循环队列中的元素个数,则循环队列的队首元素的实际位置是__(5)__。

(5)A.rear-length B.(rear-length+m) mod mC.(1+rear+m-length) mod m D.m-length●一个含有n个顶点和e条边的简单无向图,在其邻接矩阵存储结构中共有__(6)__个零元素。

(6)A.e B.2e C.n2-e D.n2-2e●若一棵哈夫曼(Huffman)树共有9个顶点,则其叶子结点的个数为__(7)__。

(7)A.4 B.5 C.6 D.7●若采用邻接矩阵来存储简单有向图,则其某一个顶点i的入度等于该矩阵__(8)__。

(8)A.第i行中值为1的元素个数 B.所有值为1的元素总数C.第i行及第i列中值为1的元素总个数D.第i列中值为1的元素个数●在—棵度为3的树中,若有2个度为3的结点,有1个度为2的结点,则有__(9)__个度为0的结点。

(9)A.4 B.5 C.6 D.7●设结点x和y是二叉树中任意的两个结点,在该二叉树的先根遍历序列中x在y之前,而在其后根遍历序列中x在y之后,则x和y的关系是__(10)__。

(10)A.x是y的左兄弟B.x是y的右兄弟C.x是y的祖先D.x是y的后裔●设顺序存储的某线性表共有123个元素,按分块查找的要求等分为3块。

若对索引表采用顺序查找方法来确定子块,且在确定的子块中也采用顺序查找方法,则在等概率的情况下,分块查找成功的平均查找长度为__(11)__。

(11)A.21 B.23 C.41 D.62DCDBDCCB(顺序查找平均查找长度是:(n+1)/2 (1+3)/2+(41+1)/2=23 123/3=41)●在一棵完全二叉树中,其根的序号为1,_(33)_可判定序号为p和q的两个结点是否在同一层。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档