Top Banner
Classification of Algorithms Kasun Ranga Wijeweera (Email: [email protected])
12

Classification of Algorithms

Dec 17, 2022

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Classification of Algorithms

Classification of Algorithms

Kasun Ranga Wijeweera(Email:

[email protected])

Page 2: Classification of Algorithms

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

Page 3: Classification of Algorithms

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

Page 4: Classification of Algorithms

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

Page 5: Classification of Algorithms

N LINEAR• It is generally the case that a small amount of processing is done on each input element

Page 6: Classification of Algorithms

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

Page 7: Classification of Algorithms

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

• Example: Perhaps in a double nested loop

Page 8: Classification of Algorithms

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

• Example: Perhaps in a triple nested loop

Page 9: Classification of Algorithms

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

Page 10: Classification of Algorithms

Reference

Page 11: Classification of Algorithms

Any Questions?

Page 12: Classification of Algorithms

Thank You!