- 1、本文档共87页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
算法分析初学了解
An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 20 1 2 3 4 i = 4 j = 3 key = 20A[j] = 40 A[j+1] = 20 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 20 1 2 3 4 i = 4 j = 3 key = 20A[j] = 40 A[j+1] = 20 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 40 1 2 3 4 i = 4 j = 3 key = 20A[j] = 40 A[j+1] = 40 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 40 1 2 3 4 i = 4 j = 3 key = 20A[j] = 40 A[j+1] = 40 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 40 1 2 3 4 i = 4 j = 3 key = 20A[j] = 40 A[j+1] = 40 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 40 1 2 3 4 i = 4 j = 2 key = 20A[j] = 30 A[j+1] = 40 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 40 40 1 2 3 4 i = 4 j = 2 key = 20A[j] = 30 A[j+1] = 40 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while (j 0) and (A[j] key) { A[j+1] = A[j] j = j - 1 } A[j+1] = key} } 10 30 30 40 1 2 3 4 i = 4 j = 2 key = 20A[j] = 30 A[j+1] = 30 An Example: Insertion Sort InsertionSort(A, n) {for i = 2 to n { key = A[i] j = i - 1; while
您可能关注的文档
- 托福阅读机经:光谱.docx
- 托福阅读中各类常见科技词汇总结.docx
- 托福阅读材料之北京空气质量持续严重污染.docx
- 托福阅读精选元素周期表的发展.docx
- 托福考试之阅读词汇总结Ⅴ.docx
- 托福词汇关于化学类汇总.docx
- 托福阅读素材:元素周期表的发展.docx
- 托福阅读材料之空气污染的5个污染源.docx
- 托福高频词汇之气象词.docx
- 托福阅读高频词汇荟萃【A-Z完整版】.docx
- 2021-2022学年三年级下学期数学期末试卷A卷 精选 .pdf
- 2020届高考数学压轴必刷题 专题09平面解析几何(文理合卷)(含答案).pdf
- 2021-2022学年人教版数学一年级上学期第四单元测试卷(I)卷(四).pdf
- 2020年苏科版八年级上册物理学习共同体 第2章第三节熔化和凝固实验题加.pdf
- 2021-2022年中级银行从业资格之中级银行管理题库及精品答案 .pdf
- 2020—2021年北师大版七年级数学上册期末考试及答案【完整】.pdf
- 2021-2022学年江苏省苏州市太仓市苏教版四年级上册期末调研数学试卷.pdf
- 2021-2022学年华东师大版数学八年级上册《尺规作图》导学案 .pdf
- 2021-2022学年河北省邯郸市鸡泽二中九年级(上)第一次月考化学试卷(附详 .pdf
- 2021-2022学年黑龙江省哈尔滨四十九中九年级(上)期中化学试卷(附详解.pdf
文档评论(0)