[数据结构与算法 DSA 林轩田] 1. Introduction to Data Structure and Algorithm

目录

算法

1.什么是算法

2.Five Criteria of Algorithm(算法的五大原则)

3. Correctness Proof of Algorithm(算法正确性)

4. Efficientcy of Algorithm (算法的效率)

5. Expressing Algorithm by Pseudo Code(使用伪代码)

数据结构

1.什么是数据结构

2. Good Algorithm Needs Proper Data Structure

3. Good Data Structure Needs Proper Accessing Algorithms

4. Good Data Structure Needs Proper Maintenance Algorithms

Why Data Structure and Algorithm?

1. Proper Use: Tradeoff of Different Factors

2. Different Tradeoff on Different Platforms


算法

1.什么是算法

2.Five Criteria of Algorithm(算法的五大原则)

  • input 输入的是什么
  • output 输出的是什么
  • definiteness 程序员能够看得懂
  • finiteness 电脑能够跑得完,不会死循环
  • effectiveness 电脑能够做得到

[数据结构与算法 DSA 林轩田] 1. Introduction to Data Structure and Algorithm

3. Correctness Proof of Algorithm(算法正确性)

举例:将程序问题抽象为数学问题,然后使用数学归纳法进行证明

[数据结构与算法 DSA 林轩田] 1. Introduction to Data Structure and Algorithm

附:【离散数学】对这块讲的比较多

4. Efficientcy of Algorithm (算法的效率)

  • 时间复杂度
  • 空间复杂度

5. Expressing Algorithm by Pseudo Code(使用伪代码)

  • 伪代码:使用口语的方式表达程序的内容,方便不同语言的程序员沟通理,举例:

[数据结构与算法 DSA 林轩田] 1. Introduction to Data Structure and Algorithm

  • 差劲的伪代码:
    • too details (太细节)
    • too Mysterious (看不懂)
    • too Abstract (太简略)

 

数据结构

1.什么是数据结构

  • 含义:容纳数据的一种容器

2. Good Algorithm Needs Proper Data Structure

  • 好的数据结构能够提高算法的效率

3. Good Data Structure Needs Proper Accessing Algorithms

所有数据结构都有的I/O操作

  • get 获取数据
  • insert 插入数据

4. Good Data Structure Needs Proper Maintenance Algorithms

执行以下操作后,要能够同时维护原有的数据结构

  • construct 
  • update 
  • remove 移除数据

Why Data Structure and Algorithm?

  • Algorithm 想办法节省计算资源
  • Data Strucutre 数据存储的方式

[数据结构与算法 DSA 林轩田] 1. Introduction to Data Structure and Algorithm

1. Proper Use: Tradeoff of Different Factors

鱼和熊掌不可兼得,如果妥协

  • time 
  • space
  • power
  • bandwidth
  • man
  • hour

 

2. Different Tradeoff on Different Platforms

在不同平台上的需求是不一样的,所以 trade off 是不同的 

  • parallel
  • transmission/computation