Title: Department of Computer and Information Science, School of Science, IUPUI
1Department of Computer and Information
Science,School of Science, IUPUI
CSCI 240
Analysis of Algorithms Growth Rates
Dale Roberts, Lecturer Computer Science,
IUPUI E-mail droberts_at_cs.iupui.edu
2Choosing n in t(n)
- The analysis of algorithms attempts to optimize
some critical resource. The critical resource
usually chosen is time, so t(n) represents a time
function. - t(n) is influenced by hardware and compiler.
Other factors include the algorithm used and
input to the algorithm. - Parameter n, usually referring to number of data
items processed, affects running time most
significantly. - n may be degree of polynomial, size of file
to be sorted or searched, number of nodes in a
graph, etc.
3Best Case, Worse Case and Average Case Defined
- Best case is amount of time program would take
with best possible input configuration - best case is found for input and easier to find
not usually the metric chosen - Worst case is amount of time program would take
with worst possible input configuration - worst case is found for input and easier to find
usually the metric chosen - Average case is amount of time a program is
expected to take using "typical" input data - definition of "average" can affect results
- average case is much harder to compute
4Average Case and Worse Case
- An algorithm may run faster on certain data sets
than on others. - Finding the average case can be very difficult,
so typically algorithms are measured by the
worst-case time complexity. - Also, in certain application domains (e.g., air
traffic control, surgery, IP lookup) knowing the
worst-case time complexity is of crucial
importance.
5Comparison of Growth Rates
- Functions in Increasing Order
6Comparison of Growth Rates (cont)
7Comparison of Growth Rates (cont)
8Comparison of Growth Rates (cont)
9Comparison of Growth Rates (cont)
10Comparison of Growth Rates (cont)
11Acknowledgements
- Philadephia University, Jordan
- Nilagupta, Pradondet