Algorithmic Complexity

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Critical section

The heart of the algorithm. The area of the algorithm that dominates the overall execution time of an algorithm. USUALLY: inside loops and recursion (innermost).

Benchmarking

Way to measure efficiency Advantages: precise information for given configuration Disadvantages: does not measure intrinsic efficiency, affected by hardware/software

How to calculate:

As n increases, highest order term dominates. Drop coefficients

Types of analyses:

Best case, worst case, average case

Worst case

Highest number of steps required. Useful for upper bound on worst performance

Asymptotic analysis

Mathematically measure program efficiency. Remove constants and low order terms

"Big Oh" -> O()

Measures intrinsic efficiency. Dominates efficiency for large input sizes. Represents upper bound on number of algorithm's steps for a sufficiently large input size

Average case

Number of steps required for a typical case

Some common algorithmic complexities (in order from least to greatest):

O(1) = constant, O(logn) = logarithmic, O(n) = linear, O(nlogn) = NlogN, O(n^2) = quadratic, O(n^k) = polynomial, O(k^n) = exponential

Binary search

O(logn)

Linear search

O(n)

Best case

(Not useful) lowest number of steps required

Formal Definition of Big-Oh

f(n) is O(g(n)) if for some constants M & N_, M * g(n) >= f(n) for all n >= N_ This breaks down to: for some coefficient M & all data sizes >= N_, M * g(n) >= f(n)


Kaugnay na mga set ng pag-aaral

Module 2: Engagement Planning, Obtaining an Understanding of the Client and Assessing Risks

View Set

BIOL252 07: Chpt 10 appendicular skeleton

View Set

Microbiology Chapter 14: Innate Immune Response

View Set

Campbell Biology: Ninth Edition - Chapter 1: The Study of Life

View Set

SECTION 1: Events of Jesus' Life

View Set