华师大数据结构期中考试试卷(含答案)

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

华东师范大学期中试卷

2007—2008学年第二学期

课程名称:______数据结构_____

姓名:___________________ 学号:__________________

专业:___________________年级/班级:__________________

课程性质:专业必修

一、单项选择题(共18分,每题3分)

1、Stack hasthe propertycalled lastinand first out,then whi chof the following describes the propertyof Queue?

a)Last inandfirst out

b) Firstinand last out

c)First inand first out

2、 A listof itemsfromwhich only theitemmostrecently added can be removed isknown as a ( )

a)stack

b)queue

c) circular linked list

d)list

3、If the following function is called with avalueof 2 for n, what is the resultingoutput?ﻩ

ﻩvoid Quiz(int n )

ﻩ{

if (n >0)

ﻩﻩ{

ﻩcout << 0;

ﻩQuiz(n- 1);

ﻩﻩcout<< 1;

ﻩQuiz(n- 1);

ﻩ}

ﻩ}

a) 00011011

b)ﻩ

11100100

c)10011100

d)ﻩ01100011

e) ﻩ001101

4、A heapis a list in whicheach entry containsakey,and, for allpositions i in the list, thekeyat positioni is at lease as large as the keysin positions 2i+2 and( ), provided these positions existin the list、

a)2i

b) 2i-1

c) 2i-2

d)2i+1

5、Giventhe recursive function ﻩ

ﻩint Func(/* in*/ inti,

ﻩﻩ/* in*/ intj )

ﻩ{

if(i<11)

ﻩﻩif (j < 11)

ﻩﻩreturn i +j;

else

ﻩﻩreturnj+ Func(i,j- 2);

ﻩﻩelse

return i+Func(i - 1, j);

ﻩﻩ}

what is thevalue of the expression Func(12,15) ?

a)ﻩ81

b) 62

c) 19

72

d)ﻩ

e)ﻩnone of the above

6、Shell sort finally perform an ordinary( )?

a) Heap sort

b)Insertionsort

c) Selection sort

d)Quick sort

二、填空题(共22分,每空2分)

1、Ifthefollowing function iscalled with avalueof75 for

n, theresulting output is

_______【1】_________、

ﻩvoid Func( /* in*/int n)

ﻩ{

ﻩif(n > 0)

Func(n / 8);

ﻩcout<<n % 8;

ﻩﻩ}

}

2、Givethe output of thefollowing program、________【2】

__________、

template

void print(List_entry &x){

cout<

voidmain( ){

Listmylist;

ﻩfor(int i=0;i<5;i++)mylist、insert(i,i);

cout<<"Yourlisthave "<

mylist、remove(2,i);

ﻩmylist、insert(i,i);

ﻩmylist、traverse(print);

ﻩmylist、clear();

ﻩfor(i=1;i<3;i++)mylist、insert(i,i);

mylist、traverse(print);

}

3、Read thefollowing program and fill the blankto pletethe me thod、

template

structNode {

// datamembers

ﻩNode_entry entry;

Node *next;

ﻩNode *back;

// constructors

Node();

Node(Node_entryitem,Node*link_back =NULL,Node *link_next =NULL);

};

template <class List_entry>

voidList ::set_position(intposition) const

/*Pre:positionis avalidposition in theList : 0<=pos ition< count 、

Post: The current Node pointerreferencesthe Node at position 、*/

ﻩif(current_position<=position)

ﻩﻩfor( ;current_position !=position;current_position++)

ﻩﻩﻩ【3】;

else

ﻩfor (; current_position!=position; 【4】)

相关文档
最新文档