Discrete Mathematics Summer 2006. By Dan Barrish-Flood originally for Fundamental Algorithms For use by Harper Langston in D.M. What is an Algorithm?. A problem is a precise specification of input and desired output
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
By Dan Barrish-Flood originally for Fundamental Algorithms
For use by Harper Langston in D.M.
tJ is the number of times the “while” loop test in line 5 is executed for that value of j. Total running time is
c1 (n) + c2(n-1) +…+c8(n-1)
“Insertion sort runs in q(n2) time, worst-case.”
I.e. It never “goes down” — always increases or stays the same.
For strictly increasing, replace £ in the above with <.
I.e. The function is always going up.
Yes! (But not strictly increasing.)
If , then is strictly increasing.
So even increases forever to
A polylogarithm is just
We’ve seen that 3n + 8 = O(n).
Is 10n = O(3n + 8)?
Yes: choose c = 10, n0 = 1:
10n£ 30n+ 80
2n2 + 5n - 8 = O(n2)?
2n2 + 5n - 8 £ cn2
¸n2: 2 + 5/n - 8/n2£c
Choose c = 3; subtracting 2:
5/n - 8/n2£ 1
Choose no = 5