*This preview shows
pages
1–2. Sign up to
view the full content.*

COP 3502 – Lab Notes
Continuation of Order Analysis
Last week’s lab introduced you to the concept of order analysis.
This week we will use
this information to estimate the running time of algorithms based on their order.
Estimating Run-Time
We know that we can't accurately compare run times measured on different machines,
or with different operating systems or languages or compilers. But, what if we have
measured the run time of a specific algorithm, on a specific combination of hardware,
OS, language and compiler? How do we estimate the new run time just for a change in
data size?
If the algorithm is linear, i.e., O(n), it should be easy. If we know the ratio of old data
size to new data size, we know the increase or decrease in time. For example: if it took
10 seconds for n = 50, then if we double the data size to n = 100, it should take twice as
long.
Since increases in data size are not always going to be by integer multipliers,
we should generalize this calculation to a simple formula that can be used for
any values:
time
new
n
new
time
old
n
old
=
This formula is based on the fact that the ratio of data size (n) over time is the same for
both the old and new data sizes, i.e., the time to perform each step is the same. The
increase or decrease in time comes from the change in the size of the data, which

This ** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
This is the end of the preview. Sign up
to
access the rest of the document.