Prog01 - CSC 375 Program 1 George Corser 2009 February 13...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 375 Program 1 George Corser 2009 February 13 An Analysis of Three Algorithms In theory, algorithms behave according to mathematical rules. Is this also true in practice? To answer this question, I implemented four algorithms, with four theoretical asymptotic bounds—cubic (Θ(n 3 )), quadratic (Θ(n 2 )), linearithmic (Θ(n log n)), and linear (Θ(n)). For each of these algorithms, I created a program function which yields the maximum sum contained in a sequence of numbers. This sum is called the maximum sequence sum , or MSS. Because of its extremely rapid growth rate, the cubic algorithm was omitted from this report. Analysis of the remaining three algorithms follows. I executed each function using data input of various sizes, ranging from one hundred to fifty thousand numbers. First, I executed the functions using integers. Next, I executed the functions using floating point numbers. Finally, I performed the whole process again on a second computer. I recorded the time it took to run each algorithm against each data set on each computer. The results are reported in the table below. Table 1: Raw Data Computer 1: Acer Aspire Computer 2: DAVE Unloaded Unloaded Integers Floats Integers Floats Inputs Linear O(nlogn) Quadratic Linear O(nlogn) Quadratic Linear O(nlogn) Quadratic Linear O(nlogn) Quadratic 100 0 0 0.093 0 0.015 0.125 0 0.01 0.08 0 0.01 0.08 200 0 0.015 0.343 0.016 0.031 0.438 0 0.02 0.3 0 0.01 0.29 300 0 0.016 0.765 0 0.062 1 0.01 0.02 0.651 0.01 0.03 0.64 400 0.016 0.046 1.343 0.015 0.078 1.641 0.01 0.04 1.261 0.01 0.04 1.211 500 0 0.046 2.125 0.016 0.11 2.547 0.01 0.04 1.862 0.01 0.04 1.802 600 0 0.062 3.015 0.016 0.093 3.797 0.01 0.06 2.744 0.01 0.06 2.734 700 0.016 0.078 4.125 0.016 0.109 5.156 0.01 0.06 3.775 0.01 0.06 3.675 800 0 0.078 5.375 0.016 0.125 6.672 0.01 0.08 4.796 0.01 0.09 4.706 900 0.016 0.093 6.796 0.016 0.125 8.594 0.01 0.09 5.968 0.01 0.09 5.928 1000 0.031 0.109 9.031 0.031 0.171 10.562 0.01 0.1 7.35 0.02 0.1 7.24 1000 0.016 0.094 8.437 0.016 0.187 10.235 0.01 0.1 7.34 0.01 0.1 7.25 2000 0.11 0.219 36 0.046 0.406 42.078 0.03 0.2 28.561 0.03 0.28 28.3 3000 0.047 0.343 79.156 0.078 0.453 94.891 0.04 0.32 64.052 0.04 0.35 63.461 4000 0.078 0.453 133.859 0.109 0.64 187.093 0.06 0.43 113.543 0.06 0.47 115.035 5000 0.078 0.593 209.421 0.141 0.843 294.453 0.07 0.55 179.107 0.07 0.61 175.852 6000 0.093 0.735 304.625 0.141 1.141 na 0.08 0.671 na 0.08 0.721 254.686 7000 0.11 0.86 409.453 0.172 1.391 na 0.1 0.791 na 0.1 0.861 345.046 8000 0.141 0.985 535.375 0.203 1.36 na 0.11 0.931 na 0.11 0.991 454.113 9000 0.141 1.172 677.906 0.234 1.641 na 0.13 1.121 na 0.13 1.131 na 1000 0 0.172 1.266 836.953 0.25 2.078 na 0.15 1.191 na 0.15 1.251 na 1000 0 0.156
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Prog01 - CSC 375 Program 1 George Corser 2009 February 13...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online