classification of algorithms

Post on 26-May-2015

235 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Classification of Algorithms

Kasun Ranga Wijeweera

(Email: krw19870829@gmail.com)

Background• N = Primary Parameter• N might be

The degree of a polynomial The size of a file to be sorted or searched The number of nodes in a graph, etc

1 CONSTANT• Most instructions of most programs are executed once or at

most only a few times• If all the instructions of a program have this property, we say

that its running time is constant

Log N LOGARITHMIC• This running time commonly occurs in programs that solve a

big problem by transforming it into a smaller problem, cutting the size by some constant fraction

N LINEAR• It is generally the case that a small amount of processing is

done on each input element

N Log N LINE ARITHMIC• This running time arises for problems that solve a problem by

breaking it up into smaller sub problems, solving them independently, and then combining the solutions

N2 QUADRATIC• These problems arise in algorithms that process all pairs of

data item• Example: Perhaps in a double nested loop

N3 CUBIC• These problems arise in algorithms that process triples of data

items • Example: Perhaps in a triple nested loop

2N EXPONENTIAL• These problems arise naturally as “brute force” solutions to

problems

Reference

Any Questions?

Thank You!

top related