Chapter 11 :Analysis of Algorithms

¡Supera tus tareas y exámenes ahora con Quizwiz!

comparing groth functions

- A faster CPU helps, but not relative to the dominant term

Problem size

- for every algorithm we want to analyze, we need to define the size of the problem -dishwashing problem has a size of n -for a search algorithm, the size of the problem is the size of the search pool -for a sorting algorithm, the size of the program is the number of elements to be sorted

Algorithm Efficency

-The efficiency of an algorithm is usually expressed in terms of its use of CPU time -involves categorizing an algorithm in terms of efficiency EX: washing a dish takes 30 seconds and drying takes 30 seconds- Therefore n dishes, require n minutes to wash and dry

space complexity:

Amount of additional memory (in addition to the memory for the input data) needed to execute an algorithm- smaller is better)

Time complexity:

Amount of time to execute an algorithm-- shorter is better

comparing growth functions

As n increases, the various growth functions diverge dramatically. - for large values of n, the difference is even more pronounced

Asymptotic Complexity:

The general nature of the algorithm as n increases

Asymptotic complexity

based on the dominant term of the growth function- the term that increases most quickly as n increases - the dominant term for the second dishwashing

Growth Rate: polynomial function

expressed as a sum of terms

Analyzing loop execution

first determine the order of the body of the loop, then multiply that by the number of times the loop will execute

Complexity:

how do the resource requirements of a program or algorithm scale.

Performance:

how much time/memory/.. is actually used when a program is run. -this depends on the machine, compiler, as well as the code

***The

number of insturctions executing is independent of the size of the input

Big-oh notation

the coefficients and lower order terms become increasingly less relevant as n increases -Two algorithms in the same category are generally considered to have the same efficency, but that doesn't mean they have equal growth functions or behave exactly the same for all values of n

why analyze growth rates?

the dominant term contributes the most to the value of the function for sufficently large input sizes -the exact value of the constant differs across different machines -We are mostly concerned with large inputs

Dominant term-

the term that has the most impact on the growth rate

Growth Functions

we must decide what we are trying to optimize -time complexity- CPU time -space complexity- memory space -CPU time is generally the focus -A growth function shows the relationship between the size of the problem(n) and the value optimized(time)


Conjuntos de estudio relacionados

Lecture 5: Requirements Engineering I & II

View Set

SIUC CHEM 210 Chapter 14 homework

View Set

Statistics Homework 1 MyLab Stats

View Set

Principles of Information Securtiy Midterm

View Set

AP Psych Sensation and Perception: Selective Attention/Perceptual Organization

View Set

Chapter 4 Taking Values Seriously

View Set

ABeka World Literature chs. 9-12 REVIEW

View Set

understanding the scriptures chapter 22 pre-test prep (DON'T USE)

View Set