网站大量收购闲置独家精品文档,联系QQ:2885784924

2013半期考试-数据结构与算法.ppt

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
2013半期考试-数据结构与算法要点

Mid-term Exam(周四上午) 1. (5分)什么是数据的逻辑结构?数据的逻辑结构可以分为哪几类? 2. (5分)证明:在具有n(n=1)个结点的m叉树中,有n(m-1)+1个指针是空的。 3. (5分) In the linked list implementation, the current pointer points to the previous element of the logical current node, not point to the logical current node. Why? 4. (10分) Determine Θ for the following code fragments in the average case. (1) a=0; for(k=1; kn-1; k++) for(j=n; j=k; j--) a += k; (2) sum = 0; for (i=1; i=n; i++) for (j=1; j=n; j*=2) sum++; 5. (10分) Suppose you have a binary tree whose data fields are single characters. When the data fields of the nodes are output: (1) in inorder: the output is DGBAHEICFJ (2) in postorder: the output is GDBHIEJFCA Draw the binary tree showing the data in each node, and show the steps used to arrive at the result. 6. (10分)若一个由2000个字符组成的文件中只有8种字符{a, b, c, d, e, f, g, h},以相对频率{12, 7, 11, 17, 21, 4, 9, 19}出现,要求: 给出各字符的Huffman编码,并计算该文件的编码长度;计算每个字符的平均编码长度。 7. (10分) Show the heap that results from deleting the minimum value from the following min-heap. 13 27 38 49 65 76 50 97 后面3题是算法设计题。要求: (1)尽量用代码实现,语言不限,要有必要的注释; (2)实在不会写代码,也可以用伪代码实现,要求逻辑清晰,无歧义; 8. (15分)算法设计题: Write a function to merge two linked lists. Elements in input lists have been sorted from lowest to highest. The output list should be sorted from highest to lowest. Your algorithm should run in linear time on the length of the output list. 9. (15分)算法设计题: Write a recursive function named smallcount that, given the pointer to the root of a BST and a key K, returns the number of nodes having key values less than or equal to K. Function smallcount should visit as few nodes in the BST as possible. 10. (15分)算法设计题: The class of binary tree node is given below. class BinNodePtr{ public: char val; //value BinNodePtr* lc; //left child BinNodePtr* rc; //right child } BinNodePtr root; // root node You are to write a method elementAtLevel(int theLevel) which ret

文档评论(0)

dajuhyy + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档