Documente Academic
Documente Profesional
Documente Cultură
(DSA – 02)
Case Studies
Amortization
Experimentation
Case Studies
to analyse algorithms
Values
Prefix average
Quadratic–Time Prefix Averages Algorithm
Computes every element of A separately.
for i ← 0 to n – 1 do O(n)
a← 0
for j ← 0 to i do O(n2)
a ← a + X[j]
A[i] ← a / (i + 1)
return array A
∴ A[i] = Si / (i + 1)
Linear–Time Prefix Averages Algorithm
In Finance
Systematic repayment (in monthly installments) of a debt.
In Accounting
Systematic writing off of some account
over a period of years.
Advantage
Does Average–Case analysis
without using any Probability.
Techniques
Accounting method (based on financial model)
Potential
function method (based on energy model)
Experimentation
Steps in Experimentation
Deciding what to test.