Analysis of Algorithms Growth Rates Department 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@cs.iupui.edu
Choosing 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.
Best 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
Average 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.
Comparison of Growth Rates Functions in Increasing Order
Comparison of Growth Rates (cont)
Comparison of Growth Rates (cont)
Comparison of Growth Rates (cont)
Comparison of Growth Rates (cont)
Comparison of Growth Rates (cont)
Acknowledgements Philadephia University, Jordan Nilagupta, Pradondet