2007级数据结构试卷A.doc_第1页
2007级数据结构试卷A.doc_第2页
2007级数据结构试卷A.doc_第3页
2007级数据结构试卷A.doc_第4页
2007级数据结构试卷A.doc_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

_ _ 诚信应考,考试作弊将带来严重后果! 华南理工大学期末考试 Data Structure A试卷注意事项:1. 考前请将密封线内填写清楚; 2. 所有答案请直接答在试卷上; 3考试形式:闭卷; 4. 本试卷共十大题,满分100分,考试时间120分钟。题 号一二三四五六七八九十总分得 分评卷人1. Select the correct choice. (20 scores, each 2 scores)(1) An algorithm must be or do all of the following EXCEPT: ( D )(A) Correct (B) Finite (C) Terminate (D) Ambiguous(2) Pick the growth rate that corresponds to the most efficient algorithm as n gets large: ( C )(A) n! (B) 2n (C) 10nlog n (D) 2n2(3) If a data element requires 6 bytes and a pointer requires 4 bytes, then a linked list representation will be more space efficient than a standard array representation when the fraction of non-null elements is less than about: ( B ) (A) 2/3 (B) 3/5 (C) 3/4 (D) 1/2(4) Which statement is not correct among the following four: ( A )(A) The worst case for my algorithm is n becoming larger and larger because that is the slowest.(B) A cluster is the smallest unit of allocation for a file, so all files occupy a multiple of the cluster size.(C) The selection sort is an unstable sorting algorithm.(D) The number of leaves in a non-empty full binary tree is one more than the number of internal nodes.(5) Which of the following is a true statement: ( C )(A) In a BST, the left child of any node is less than the right child, and in a heap, the left child of any node is less than the right child.(B) In a BST, the left child of any node could be less or greater than the right child, but in a heap, the left child of any node must be less than the right child. (C) In a BST, the left child of any node is less than the right child, but in a heap, the left child of any node could be less than or greater than the right child.(D) In both a BST and a heap, the left child of any node could be either less than or greater than the right child.(6) The most effective way to reduce the time required by a disk-based program is to: ( B ) (A) Improve the basic operations. (B) Minimize the number of disk accesses. (C) Eliminate the recursive calls. (D) Reduce main memory use.(7) The max-heap constructed by a sequence of key (46, 79, 56, 38, 40, 84) is ( )?(A) 79, 46, 56, 38, 40, 84 (B) 84, 79, 56, 46, 40, 38(C) 84, 79, 46, 38, 40, 56 (D) 84, 56, 79, 40, 46, 38(8) If there is 0.5MB working memory, 4KB blocks, yield 128 blocks for working memory. By the multi-way merge in external sorting, the average run size and the sorted size in one pass of multi-way merge on average are separately ( A )?(A) 1MB, 128MB (B) 1MB, 64MB(C) 2MB, 64 MB (D) 0.5 MB, 128MB(9) Tree indexing methods are meant to overcome what deficiency in hashing? ( D )(A) Inability to handle range queries. (B) Inability to maximum queries(C) Inability to handle queries in key order (D) All of above.(10) Assume that we have eight records, with key values A to H, and that they are initially placed in alphabetical order. Now, consider the result of applying the following access pattern: E D F G B G F A F E G B, if the list is organized by the move-to-front heuristic, then the final list will be ( B ).(A) B G E F D A C H (B) B G E F A D C H(C) A B F D G E C H (D) F D G E A B C H2. Fill the blank with correct C+ codes: (13 scores)(1) Given an array storing integers ordered by value, modify the binary search routines to return the position of the first integer with the greatest value less than K when K itself does not appear in the array. Return ERROR if the least value in the array is greater than K: (10 scores)/ Return position of greatest element = Kint newbinary(int array, int n, int K) int l = -1; int r = n; / l and r beyond array bounds while (l+1 != r) / Stop when l and r meet _ int i=(l+r)/2_; / Look at middle of subarray if (K arrayi) _ l=i _ / In right half / Search value not in array _ return l _; / l at first value less than K / l=-1, no value less than K(2) A full 5-ary tree with 100 internal vertices has _501_vertices. ( 3 scores)3. A certain binary tree has the preorder enumeration as ABECDFGHIJ and the inorder enumeration as EBCDAFHIGJ. Try to draw the binary tree and give the postorder enumeration. (The process of your solution is required!) (8 scores)EBCDFHIGJAABEFCDHIGJABEFCDGJHIABEFCDGJHIPostorder enumeration: EDCBIHJGFA4. Determine for the following code fragments in the average case. Assume that all variables are of typ

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论