本文共 1421 字,大约阅读时间需要 4 分钟。
算法导论Lesson1
内容主要包括:
What’s more important than perf?
cost, ux Why study algs and perf? infeasable ->feasable perf like the currency in economy Perf is the precondition to have good ux. bottom of heap Speed is always fun.Problem Sorting
input sequence [a1,a2,…,an] of numbers output permutation[a1’,a2’,…,an’] to sorted as smaller->biggerInsertion Sort
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 stat. distr.)Best-case:(bogus)
cheatWhat’s my sort’s worst time?
Depends on computerabsolute speed(on different machines)
BIG DATA 渐进分析 look at the growth of time when n->infinity Asymptotic notation:O(n**3) Drop low-order such as n**2,n,constant and leading constant.
arithmetic series(算术级数,等差级数)
教授居然说,我们这里有高手知道算数级数,沟通就好办了。 Merge Sort小结:
两种排序算法 对于排序问题,本节课提供了两种算法,分别是插入排序和合并排序。插入排序是O(n*n),合并排序是O(nlgn)
其中合并排序运用了递归调用和分治策略,这两个内容将分别在后续两节中介绍。
转载地址:http://jojtb.baihongyu.com/