week1 Analysis of Algorithms Introduction

keywords(50m):

  • performance of algorithms(12 times)
  • running time(7 times) shortest time
  • performance prediction
  • scientific method(4 times)

How to make mathematical models and how to classify algorithms according to the order of growth of their running time.

Different perspectives

role perspective
Programmer needs to develop a working solution(algorithm designer)
Client wants to solve problem efficiently(algorithm user)
Theoretician wants to understand(algorithm prover)
Team basic blocking and tackling
Student may play all the roles

Running time

“ As soon as an Analytic Engine exists, it will necessarily guide the future
course of the science. Whenever any result is sought by its aid, the question will arise—By what course of calculation can these results be arrived at by the machine in the shortest time? ” — Charles Babbage (1864)

Reasons to analyze algorithms

  • Predict performance.
  • Compare algorithms.
  • Provide guarantees.
  • Understand theoretical basis.
    Primary practical reason: avoid performance bugs.

And it's very, very frequent to see, in today's computational infrastructure, a situation where the client gets bad performance, because the programmer did not understand the performance characteristics of the algorithm.

Some algorithmic successes

Discrete Fourier transform.

  • Break down waveform of N samples into periodic components.
  • Applications: DVD, JPEG, MRI, astrophysics, ….
  • Brute force: N^2 steps.
  • FFT algorithm: N log N steps, enables new technology.

N-body simulation.

  • Simulate gravitational interactions among N bodies.
  • Brute force: N 2 steps.
  • Barnes-Hut algorithm: N log N steps, enables new research

The challenge

Q: will my program be able to solve a large practical input?

  • why is my program running so slowly?
  • Why does it run out of memory?

Insight. [Knuth 1970s] Use scientific method to understand performance.

Scientific approach to applied to analysis of algorithms

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(more) observations.
  • Validate by repeating until the hypothesis and observations agree.

Basic principles

Principles.

  • Experiments must be reproducible.
  • Hypotheses must be falsifiable.And also the hypotheses have to have a specific property that the experiment can show the hypothesis to be wrong.
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 那天下夜班,忙碌了一夜的我刚躺下,迷迷糊糊将要进入梦乡的时候,突然被刺耳的手机铃声惊醒,陌生的号码,陌生的声音,等...
    那时那刻阅读 5,501评论 0 2
  • 今天看到朋友圈里晒出的各种游玩和回家的照片,我才意识到今天已经是五一假期的第一天了。今天我和女朋友都没能得到休假,...
    MosquitoSwallow阅读 2,972评论 0 0
  • 黄昏中律动的烛火 烧不破 熄不灭 远道而来的大雁 扎进火里 也飞不出凤凰 凝视的眼睛 渐成一幅画 画外,在咒骂声中...
    四夕山人阅读 2,615评论 0 1
  • 〖每日拔拔草〗三度思维空性 今天整理企业QQ后台信息,几次没弄好,内心就开始烦躁。 〖每日浇浇水〗三次感恩 1.感...
    lindacheng2017阅读 1,832评论 0 0
  • jQuery 基础语法是:$(selector).action() 美元符号定义 jQuery选择符(select...
    W凯阅读 2,415评论 0 0

友情链接更多精彩内容