欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

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

    • 资源ID:12965317       资源大小:54KB        全文页数:14页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

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

    . .华东师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 list 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); 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. Given the recursive function int Func( /* in */ int i, /* in */ int j ) if (i < 11) if (j < 11) return i + j; else return j + Func(i, j - 2); else return i + Func(i - 1, j); what is the value of the expression Func(12, 15) ? a)81 b)62 c)19 d)72 e)none of the above6. Shell sort finally perform an ordinary ( )?a) Heap sortb) Insertion sortc) Selection sortd) Quick sort二、 填空题(共22分,每空2分)1. If the following function is called with a value of 75 for n, the resulting output is _【1】_. void Func( /* in */ int n ) if (n > 0) Func(n / 8); cout << n % 8; 2. Give the output of the following program. _【2】_.template <class List_entry>void print(List_entry &x)cout<<x<<" "void main( )List<int> mylist;for(int i=0;i<5;i+)mylist.insert(i,i);cout<<"Your list have "<<mylist.size()<<" elements:"<<endl;mylist.remove(0,i);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 the following program and fill the blank to plete the method.template <class Node_entry>struct Node / data membersNode_entry entry;Node<Node_entry> *next;Node<Node_entry> *back;/ constructorsNode( );Node(Node_entry item, Node<Node_entry> *link_back = NULL, Node<Node_entry> *link_next = NULL);template <class List_entry>void List<List_entry> : 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 (current_position <= position)for ( ; current_position != position; current_position+) 【3】 ;elsefor ( ; current_position != position; 【4】 )current = current->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: 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 Record . */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_present;5. The following program is the divide_from function of Merge Sort. Please fill the blank to plete the function. Node<Record> * divide_from (Node<Record> *sub_list)/* Post: The list of nodes referenced by sub_list has been reduced to its first half, and a pointer to the first node in the second half of the sublist is returned. If the sublist has an odd number of entries, then its first half will be one entry larger than its second.*/Node<Record> *position, / traverses the entire list*midpoint, / moves at half speed of position to midpoint*second_half;if (midpoint = sub_list) = NULL) return NULL; / List is empty.position = midpoint->next;while (【9】 ) / Move position twice for midpoint's one move.position = position->next;if (position != NULL) 【10】 ;position = position->next; second_half = 【11】 ;midpoint->next = NULL;return second_half;三、 编程题(共60分)1. (16分)Apply quicksort to the following list of 14 names, where the pivot in each sublist is chosen to be (a) the first key in the sublist and (b) the last key in the sublist. In each case, draw the tree of recursive call.Tim Dot Eva Roy Tom Kim Guy Amy Jon Ann Jim Kay Ron Jan2. (16分)Write the following overload operator for stacks:1) bool Stack:operator = (const Stack & s);2) bool Stack:operator += (const Stack & s);/ pushes the contents of the given stack onto this stack;3. (10分)Write the following function temple:Template <class T> void reverse(Queue <T> & q);/ reverses the contents of the given queue;4. (18分)struct Node / data membersint entry;Node *next;/ constructorsNode( );Node(int item, Node *link = NULL);f is the head pointer of a link list of nodes.Using recursion, implement the following functions:1) int Max (Node *f ); /return the max value in the link list.2) int Num (Node *f );/return the number of the nodes in the link list3) Node * Search ( Node *f, int x );/Search the first occurrence of the x in the link list. If success returns the /pointer to the node, else returns NULL.数据结构期中考卷参考答案. .word. .一、 单项选择题(3×618)1 c2 a3 e4 d5 a6 b二、 填空题(2×1122)【1】113【2】Your list have 5 elements:1 2 4 3【3】current = current->next【4】current_position-【5】(bottom + top)/2【6】position = mid【7】mid + 1【8】mid 1【9】position != NULL【10】midpoint = midpoint->next;【11】midpoint->next. .word. . .word. .三、 编程题(16×2101860)1,a) P344 F8.12b)2. 1) bool Stack:operator=(const Stack &s)Stack s1=s, s2=*this;while (!s1.empty( )if (s1.top( )!= s2.top( ) return false;else s1.pop( ); s2.pop( );2) bool Stack: operator+=(const Stack &s)Stack ss=s, s2;while (!ss.empty( )s2.push(ss.top( );ss.pop( );while (!s2.empty( )if(push(s2.top( ) = oute) return false;s2.pop( );3Template <class T> void reverse (Queue<T> & q)Stack<T> s  T data;while ( !q.empty( ) q.retrieve(data ); s.push( data); q.serve( );while (!s.empty( )q.append(s.top( );s.pop( );4. int Max (Node *f ) if ( f ->next = NULL ) return f ->entry;int temp = Max ( f ->next );if ( f ->data > temp ) return f ->entry;else return temp;int Num ( Node *f ) if ( f = NULL ) return 0;return 1+ Num ( f ->next );Node * Search ( Node *f, int x ) if ( f = NULL)return NULL;else if ( f entry = x ) return f; else return Search( fnext , x);. .word.

    注意事项

    本文(华师大数据结构期中考试试卷(含答案).doc)为本站会员(知****量)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开