日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Lecture 1 Analysis of Algorithms

發(fā)布時(shí)間:2025/3/18 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Lecture 1 Analysis of Algorithms 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

Analysis of Algorithms

The theoretical study of computer program?performance?and?resource?usage.

Performance: time

Resource: communication, RAM memory or disk memory and so on.

?

What's more important than performance?

Correctness, Simplicity, Maintainability, Robustness, Features, Functionality, Modularity, Security, User-friendliness.

Why study algorithm and performance?

They are the fundamental thing for above.

?

Problem: sorting

Input:?sequence <a1, a2, ..., an> of numbers

Output:?permutation <a1’, a2’, ..., an’>, s.t. a1’?<= a2’?<= ... <= an’

?

Insertion Sort:

Insertion-Sort(A,n) //Sorts A[1...n]

for j <- 2 to n

? ? do key <- A[j]

? ? ? ? i <- j - 1

? ? ? ? while i > 0 and A[i] > key

? ? ? ? ? ? do A[i+1] <- A[i]

? ? ? ? ? ? ? ? i <- i - 1

? ? ? ? A[i+1] <- key

?

?

Running time:

-Depends on input (eg. Already sorted)

-Depends on input size (6 elem. VS 6*10**9)

? ? -parameterize in input size

-Want upper bounds

? ? -guarantee to the user

?

?

Kinds of analysis

Worst-case?(usually): T(n) = max time on any input of size n.

Average-case?(sometimes): T(n) = expected time over all inputs of size n.

(Need assumption of statistic of distribution: uniform distribution)

Best-case?(bogus) cheat

?

What is insertion sort's worst-case time?

Depends on computer

-relative speed (on same machine)

-absolute speed (on different machine)

?

BIG IDEA! ?Asymptotic analysis

1.?Ignore machine dependent constants;

2.?Look at?growth?of T(n) as n ->?infinity.

?

轉(zhuǎn)載于:https://my.oschina.net/kuailechengxuyuan/blog/1926433

與50位技術(shù)專(zhuān)家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的Lecture 1 Analysis of Algorithms的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。