博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Introduction to Algorithms算法导论笔记-Lecture1
阅读量:2357 次
发布时间:2019-05-10

本文共 1421 字,大约阅读时间需要 4 分钟。

Introduction to Algorithms算法导论笔记

算法导论Lesson1

课程简介:

内容主要包括

  • 算法的含义、意义的简要介绍;
  • 算法的分析;
  • 插入排序、合并排序
  • 如下图:
    如下图:

这里写图片描述

preface
Analysis of Algorithms
The theoretical study of computer program
performance and resource usage

What’s more important than perf?

cost, ux
Why study algs and perf?
infeasable ->feasable
perf like the currency in economy
Perf is the precondition to have good ux.
bottom of heap
Speed is always fun.

Problem Sorting

input sequence [a1,a2,…,an] of numbers
output permutation[a1’,a2’,…,an’] to sorted as smaller->bigger

Insertion Sort

这里写图片描述
Running time:
- depends on input(e.g. sorted already)
- depends on input size( 6 elem. vs 6*10**9)

Kinds of analysis

  • Worst-case(usually)

    T(n) =max time on any input of size n

  • Average-case:(sometimes)

    T(n)=expected time over all inputs of size n

    (Need assumption of stat. distr.)

  • Best-case:(bogus)

    cheat

What’s my sort’s worst time?

Depends on computer

  • relative speed(on same machine)
  • absolute speed(on different machines)

    BIG DATA
    渐进分析
    look at the growth of time when n->infinity
    Asymptotic notation:

    O(n**3) Drop low-order such as n**2,n,constant and leading constant.

    arithmetic series(算术级数,等差级数)

    教授居然说,我们这里有高手知道算数级数,沟通就好办了。
    Merge Sort

    这里写图片描述

    1. If n=1, done
    2. Recursively sort
      a[1,…n/2] and
      a[n/2+1,…n]
    3. Merge 2 sorted lists.
      Key Subroutine: Merge
      20 12
      13 11
      7 9
      2 1
      1 2 7 9 11 13 12 20

小结:

两种排序算法
对于排序问题,本节课提供了两种算法,分别是插入排序和合并排序。

插入排序是O(n*n),合并排序是O(nlgn)

其中合并排序运用了递归调用和分治策略,这两个内容将分别在后续两节中介绍。

转载地址:http://jojtb.baihongyu.com/

你可能感兴趣的文章
js如何获取当前页面字符编码? http://bbs.51js.com/thread-75687-1-1.html
查看>>
虚拟社区之虚拟地图部分 http://bbs.51js.com/thread-75680-1-1.html
查看>>
Tooltip效果 http://cceer.xmu.edu.cn/blog/post/tooltip.html
查看>>
java好站 http://blog.csdn.net/chjk1/archive/2007/12/30/2005013.aspx
查看>>
JRun3.0配合IIS的安装全过程 http://www.knowsky.com/4179.html
查看>>
让IIS6.0全面支持asp+php+jsp最新完整版 http://www.marktip.com/blog/article.asp?id=151
查看>>
在Windows下用IIS配置Jsp和php环境 http://club.21php.com/showthread.php?t=12735
查看>>
整合Tomcat5和IIS5 及正常打开jsp http://www.7880.com/info/2004/06/01/article-603.html
查看>>
resin2.1.4 + iis 配置方法http://www.blueidea.com/tech/program/2003/1147_3.asp
查看>>
读"U盘小偷"有感 http://hi.baidu.com/sudami/blog/item/c53b3eec4a019cd22e2e217b.html
查看>>
文件夹删除不掉怎么办?http://www.blueidea.com/computer/system/2007/4496.asp
查看>>
学习内核要准备什么测试工具http://bbs.linuxpk.com/viewthread.php?tid=13066
查看>>
测试工具2006排行榜10大提名
查看>>
测试工具大全http://blog.csdn.net/vincetest/archive/2006/12/12/1440353.aspx
查看>>
关于软件测试及测试工具比较 (4) http://tech.ccidnet.com/art/292/20051020/354201_4.html
查看>>
深入研究Windows内部原理系列 http://www.microsoft.com/china/technet/webcasts/class/windowsserver1.mspx
查看>>
《深入研究Windows内部原理系列课程》[ISO]http://lib.verycd.com/2007/04/12/0000146419.html
查看>>
操作系统学习常见疑惑问与答(不断添加中...)http://purec.hit.edu.cn/viewthread.php?tid=613&extra=page%3D1&page=1
查看>>
操作系统学习常见疑惑问与答[接口规范部分]—问题1-4 http://blog.csdn.net/yxin1322/archive/2006/04/04/650898.aspx
查看>>
有什么工具能提供预编译后的源代码啊?http://expert.csdn.net/Handler.ashx?id=1943733
查看>>