INT202 Complexity of Algorithms Introduction 笔记

本文探讨了算法和数据结构的基本概念,重点分析了时间复杂性和空间复杂性。课程介绍了实验性分析与理论性分析的区别,包括算法的运行时间和输入规模的关系,以及伪代码在描述算法中的应用。
摘要由CSDN通过智能技术生成

Assessment

  • 1 In-Class Test in Week 6 (10%)
  • 1 In-Class Test in Week 13 (10%)
  • 1 Final Exam (80%)

Week1

• Basic Concepts on Algorithm Analysis

• Introduce the complexity analysis of algorithms

一 Algorithms and Data Structures

A data structure is a systematic way of organizing and accessing data.

An algorithm is a sequence of steps for performing a task in a finite amount of time.

TASK:Navigate to a place  STEP:Root-finding algorithm

二 Algorithm Analysis

The analysis of algorithm is the theoretical study of computer program performance and recourse usage.

Primary interest: Running time (time-complexity) of the algorithm and the operations on data structures.(主要时间)

Secondary interest: Space (or “memory”) usage (space-complexity).(其次空间)

• This course focuses on the mathematical design and analysis of algorithms and their associated data structures, utilizing relevant mathematical tools to do so.(算法的数学设计和分析以及相应的数据结构)

1.Experimental Analysis of Algorithms 算法的实验性分析 

To analyze algorithms we sometimes perform experiments to empirically(empirical 实证的,凭经验的) observe for example the running time.

例如:

分析 算法的运行时间或内存需求与输入规模的关系(dependency of the running time or memory requirement on size of the input

The size could mean不同情境下的不同度量单位,比如在操作图形时,可以是顶点和边的数量;在编码/解码消息时,可以是消息的长度;或者在处理数字时,可以是数字的实际长度,以位为单位存储它们所需的位数。

(1)Conduct theoretical analysis 使用实验性分析【这样的实验需要精心选择样本输入,并且进行适当数量的测试,以便我们能够对我们的分析有统计上的确定性。

In general, the running time of an algorithm or data structure method increases with the input size

Running-time depends on both the size and instance of input and the algorithm used, as well as the software and hardware environment on which it is run.

(2)Limitations of Experimental Analysis
  1. Experiments are performed on a limited set of test inputs.
  2. Requires all tests to be performed using same hardware and software.
  3. Requires implementation and execution of algorithm.

2.Theoretical Analysis 算法的理论性分析

When we analyze an algorithm in this fashion, we aim to associate a function f (n) to each algorithm, where f (n) characterizes the running-time in terms of some measure of the input-size, n.Typical functions include: n, log n, n^2 , n log n, 2^n

(1)Benefits over experimental analysis
  1. Can take all possible inputs into account.
  2. Can compare efficiency of two (or more) algorithms, independent of hardware/software environment.
  3. Involves studying high-level descriptions of algorithms (pseudo-code)  //脱离了实际运行的要求以及硬件软件环境的限制

(2)Conduct theoretical analysis 

For formal theoretical analysis, we need:

  1. A language for describing algorithms.
  2. Computational model in which algorithms are executed.(执行算法的计算模型)
  3. Metric for measuring performance.(衡量性能的标准)
  4. A way of characterizing performance.(表现性能的方式)

 

A language for describing algorithms------Pseudo-code

Pseudo-code is a high-level description language for algorithms.

1.算法名称                                                              2.input                                                                    3.output                                                                  4.代码主体                                                             • Instead of the sign arrow ← an equal sign can also be used                                                           • Instead of if-then-end if, the curly brackets {} can also be used

 Pseudo-code is a mixture of natural language and high-level programming language (e.g., Java, C, etc.). Describes a generic implementation of data structures or algorithms.

To analyze the running time of an algorithm we count the number of operations executed during the course of the algorithm.

  • 22
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值