数据结构第一章教案分析.ppt

  1. 1、本文档共101页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据结构 1.1、什么是数据结构 1.2、基本概念和术语 1.3、算法的描述和分析 1.1、什么是数据结构 旅游交通网络图 1.2 基本概念和术语 高级程序语言中如何描述存储结构 “一维数组”类型描述顺序存储结构 “指针”类型描述链式存储结构 1.3 算法的描述和分析 一、算法 二、算法的特性 三、算法设计的原则 四、算法效率的衡量方法和准则 五、算法的存储空间需求 六、算法的描述 七、类C语言语法概要 八、算法的评价 八、算法的评价 1、执行算法所耗费的时间,即时间复杂度。 T(n)=O(f(n)) 2、执行算法所耗费的存储空间,其中主要考虑辅助存储空间的大小,即空间复杂度。记作 S(n)=O(f(n)) 其中,n为问题的规模(或大小)。 3、算法是否易读、是否容易转换成任何其它可运行的语言编制的程序以及是否易被测试等等。 若输入数据所占空间只取决于问题本身,和算法无关,则只需要分析除输入和程序之外的辅助变量所占额外空间。 若所需额外空间相对于输入数据量来说是常数,则称此算法为原地工作。 若所需存储量依赖于特定的输入,则通常按最坏情况考虑。 ALGORITHM ANALYSIS 【Definition】An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms must satisfy the following criteria: (1) Input There are zero or more quantities that are externally supplied. (2) Output At least one quantity is produced. (3) Definiteness Each instruction is clear and unambiguous. (4) Finiteness If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after finite number of steps. (5) Effectiveness Every instruction must be basic enough to be carried out, in principle, by a person using only pencil and paper. It is not enough that each operation be definite as in(3); it also must be feasible. Note: A program is written in some programming language, and does not have to be finite (e.g. an operation system). An algorithm can be described by human languages, flow charts, some programming languages, or pseudo-code. 〖Example〗 Selection Sort: Sort a set of n ? 1 integers in increasing order. From those integers that are currently unsorted, find the smallest and place it next in the sorted list. Where and how are they stored? Where? for ( i = 0; i < n; i++) { Examine list[i] to list[n?1] and suppose that the smallest integer is at list[min]; Interchange list[i] and list[min]; } Sort = Find the smallest integer + Interchange it with list[i]. Algor

文档评论(0)

美洲行 + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档