Algorithms - Week 1-1 Analysis of Algorithms

Introduction

Primary practical reason: avoid performance bugs

A framework for predicting performance and comparing algorithms.

Scientific method.

  • Observe some feature of the natural world
  • Hypothesize a model that is consistent with the observations
  • Predict events using the hypothesis
  • Verify the predictions by making further observations
  • Validate by repeating until the hypothesis and observations agree.

Principles

  • Experiments must be reproducible.
  • Hypotheses must be falsifiable.

Observations

Mathematical Models

cost model, tilde notation

How to estimate a discrete sum?

  • A.1 Take discrete mathematics course.
  • A.2 Replace the sum with an integral, and use calculus!

Order-of-Growth Classifications

Theory of Algorithms

Best case. Lower bound on cost. Determined by “easiest” input. Provides a goal for all inputs.

Worst case. Upper bound on cost. Determined by “most difficult” input. Provides a guarantee for all inputs.

Average case. Expected cost for random input. Need a model for “random” input. Provides a way to predict performance.

Goals.

  • Establish “difficult” of a problem
  • Develop “optimal” algorithms.

Upper bound. A specific algorithm.

Lower bound. Proof that no algorithm can do better.

Optimal algorithm. Lower bound equals upper bound (to within a constant factor).

Algorithm design approach

Start.

  • Develop an algorithm.
  • Prove a lower bound.

Gap?

  • Lower the upper bound (discover a new algorithm).
  • Raise the lower bound (more difficult).

Memory

summary

Empirical analysis.

  • Execute program to perform experiments.
  • Assume power law and formulate a hypothesis for running time.
  • Model enables us to make predictions.

Mathematical analysis.

  • Analyze algorithm to count frequency of operations.
  • Use tilde notation to simplify analysis.
  • Model enables us to explain behavior.

Scienfic method.

  • Mathematical model is independent of a particular system; applies no machines not yet built.
  • Empirical analysis is necessary to validate mathematical models and to make predictions.
《算法导论》Hardcover版的引言(Introduction to Algorithms - Hardcover Edition)是一本经典的计算机科学教材。该版本不仅在内容上与平装版相同,还具有精美的硬皮封面,能够更好地保护书籍,并增添一份高质感和专业感。 首先,这本书是由Thomas H. Cormen等四位作者共同编写。他们是计算机科学领域的权威人物,在算法研究和教育方面具有丰富的经验。这本书的目的是为计算机科学专业的学生和从业人员提供系统而全面的算法知识,帮助他们深入理解和应用算法。 《算法导论》Hardcover版首先介绍了算法设计和分析的基础知识,包括分治法、贪婪算法、动态规划和回溯法等。接着,书中详细阐述了各种经典算法,如排序、图算法、字符串匹配、高级数据结构等。此外,书中还介绍了算法的优化技巧和应用领域,例如算法的并行化和近似算法。 与平装版相比,Hardcover版的封面更加美观,书页由高品质纸张制成,更加耐用。这使得读者在长时间研究和使用这本书时,能够更好地保存它的完整性和精美外观。此外,Hardcover版也更加适合作为礼品或收藏品,体现了读者对该书的重视和对算法学习的热爱。 总之,《算法导论》Hardcover版是一本内容丰富、思想深刻的算法教材,通过系统化的介绍和实例,帮助读者深入理解和应用各种算法。同时,Hardcover版的精美外观和耐用性也增强了读者在日常使用和收藏方面的满意度。无论是学习算法的新手还是资深专家,都能从这本书中获得极大的收益。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值