Monday, October 8, 2018

Algorithm

Algorithm

Criteria
- Structure (simplicity, easy to read ....)
- Running time
- Memory
- else

Focusing on worst case running time: easy to analyze, critical

Running time: function of input size n
Random Access Model: CPU

Pseudocode: High-level description of algorithm
for ... do ...
←(assignment), =(==), n²(mathematical format)

Primitive Operators

Big Oh
f(n) = O(g(n)): g(n) asymptotically greater than or equal to f(n)
rules: 1. use the smallest possible g(n) (e.g. 3n+1 = O(n), not O(nⁿ))
        2. use the simplest expression   (e.g. 3n+1 = O(n), not O(3n))


Asymptotic Analysis
1. Find worst case f(n)
2. Find g(n) such that f(n) = O(g(n))

f(n) = Ω(g(n)): g(n) asymptotically less than or equal to f(n)
f(n) = Θ(g(n)): g(n) asymptotically equal to g(n) 


Quiz: Is assignment primitive?

No comments:

Post a Comment

46. 伯姊贈貞夫人朴氏墓誌銘

伯姊贈貞夫人朴氏墓誌銘 *貞夫人: 2품관리의 부인 *墓誌銘: 죽은 사람의 인적사항을 돌에 적어 관에 같이 넣어둔것. 인적사항/역사를 기록한것이 誌, 죽은이를 칭송하는것이 銘이다. 여기서 銘은 근체시이다. <朴趾源> <박지...