[princeton/Algotithm I/week1](4) Analysis of Algorithms

本文深入探讨算法分析的核心概念,包括算法性能评估、科学方法的应用、数学模型构建、增长阶分类及算法理论。从Babbage机器的运行次数到现代算法的复杂度分析,全面解析算法效率提升的关键因素。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.4 Analysis of Algorithms

  • introduction

  • observations 

  • mathematical models 

  • order-of-growth classifications

  • theory of algorithms

  • memory

 

1.4.1 Introduction:

1. the cast of characters:

 

2.Focus on the running time:

Babbage machine - how many times do you have to turn the crank?

 

3. Algorithms performance

 

4. better performance (success algorithms)

minimize the running time

 

In the 1970s, Kanoof, use the scientific method to understand the performance of algorithms in operation.

 

5. Scientific method applied to analysis algorithms 

 

1.4.2 Observations

1. running time of the program 

Examples: 3-sum problem 

 

2. measuring the running time 

Plot running time T(N), input size N

3. log-log scale

Fit the line: a\ N^b

 

4. prediction and validation

 

5. ratios 

 

6. Key factors determine the running time 

 

1.4.3 Mathematical models

Cost of basic operations

Example: 1-Sum

 

Simplifying the calculation

Tilde notation

Example: 2-Sum

Example: 3-Sum                                                                                                                       

Estimating a discrete sum(calculus)

Mathematical models for running time 

 

1.4.4 Order-of-growth classifications

 

Common order-of-growth classifications

Binary search demo

Mathematical analysis: Binary search

An M^2logN algorithm for 3-Sum

Compare running time 

 

1.4.5 Theory of Algorithms

notations

example 1: 1-sum

example 2: 3-sum

The GAP between lower and upper bound

 

 

1.4.6 Memory

 

Typical memory usage summary

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值