Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 2

Algorithms

Algorithm Analysis
In computer science, the analysis of algorithms is the determination of the
amount of resources (such as time and storage) necessary to execute them.

Overview
Usually, the efficiency or running time of an algorithm is stated as a function relating the input
length to the number of steps (time complexity) or storage locations (space complexity). Algorithm
analysis is an important part of a broader computational complexity theory, which provides
theoretical estimates for the resources needed by any algorithm which solves a given computational
problem. These estimates provide an insight into reasonable directions of search for efficient
algorithms. In theoretical analysis of algorithms it is common to estimate their complexity in the
asymptotic sense, i.e., to estimate the complexity function for arbitrarily large input. Big O
notation, Big-omega notation and Big-theta notation are used to this end.
• Rule of thumb: Simple programs can be analyzed by counting the nested loops of the
program. A single loop over n items yields f( n ) = n. A loop within a loop yields f( n ) = n2. A
loop within a loop within a loop yields f( n ) = n3.
• Rule of thumb:Given a series of for loops that are sequential, the slowest of them determines
the asymptotic behavior of the program. Two nested loops followed by a single loop is
asymptotically the same as the nested loops alone, because the nested loops dominate the
simple loop.
• Asymptotic comparison • Numeric comparison
operator operator

Our algorithm is o( something ) A number is < something

Our algorithm
A number is ≤ something
is O( something )

Our algorithm
A number is = something
is Θ( something )

You might also like