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





《华师大数据结构期中考试试卷(含答案).doc》由会员分享,可在线阅读,更多相关《华师大数据结构期中考试试卷(含答案).doc(14页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、. .华东师X大学期中试卷20072008学年第二学期课程名称:_数据结构_姓 名:_ 学 号:_专 业:_ 年级/班级:_课程性质:专业必修一二三四五六七八总分阅卷人签名一、 单项选择题(共18分,每题3分)1. Stack has the property called last in and first out, then which of the following describes the property of Queue?a) Last in and first outb) First in and last outc) First in and first out2. A l
2、ist of items from which only the item most recently added can be removed is known as a ( )a) stack b) queue c) circular linked list d) list3. If the following function is called with a value of 2 for n, what is the resulting output?void Quiz( int n ) if (n 0) cout 0; Quiz(n - 1); cout 1; Quiz(n - 1)
3、; a)00011011 b)11100100 c)10011100 d)01100011 e)0011014. A heap is a list in which each entry contains a key, and, for all positions i in the list, the key at position i is at lease as large as the keys in positions 2i+2 and ( ), provided these positions exist in the list.a) 2ib) 2i-1c) 2i-2d) 2i+15
4、. Given the recursive function int Func( /* in */ int i, /* in */ int j ) if (i 11) if (j 0) Func(n / 8); cout n % 8; 2. Give the output of the following program. _【2】_.template void print(List_entry &x)coutx ;void main( )List mylist;for(int i=0;i5;i+)mylist.insert(i,i);coutYour list have mylist.siz
5、e() elements:endl;mylist.remove(0,i);mylist.remove(2,i);mylist.insert(i,i);mylist.traverse(print);mylist.clear( );for(i=1;i3;i+)mylist.insert(i, i);mylist.traverse(print);3. Read the following program and fill the blank to plete the method.template struct Node / data membersNode_entry entry;Node *ne
6、xt;Node *back;/ constructorsNode( );Node(Node_entry item, Node *link_back = NULL, Node *link_next = NULL);template void List : set_position(int position) const/* Pre: position is a valid position in the List : 0 =position count .Post: The current Node pointer references the Node at position . */if (
7、current_position back;4. Read the following program and fill the blank to plete the method.Error_code recursive_binary_2(const Ordered_list &the_list, const Key &target, int bottom, int top, int &position)/* Pre: The indices bottom to top define the range in the list to search for the target .Post:
8、If a Record in the range from bottom to top in the list has key equal to target , then position locates one such entry, and a code of success is returned. Otherwise, not_present is returned, and position is undefined.Uses: recursive_binary_2, together with methods from the classes Ordered_list and R
9、ecord . */Record data;if (bottom = top) int mid = 【5】 ;the_list.retrieve (mid, data);if (data = target) 【6】 ;return success;else if (data target)return recursive_binary_2(the_list, target, 【7】 , top, position);elsereturn recursive_binary_2(the_list, target, bottom, 【8】 , position);else return not_pr
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 师大 数据结构 期中考试 试卷 答案

限制150内