algorithm - Determinating Complexity time -
i'm doing project university how determinate complexity assuming known algorithm running times depending on data size.
the types of algorithm use polynomial (n2, n3,..,n6), logarithmic , exponential.
for example, imput of program can be:
n 1 2 3 4 5 6 7 8 9 10 11 12 (data size)
t(n) 0,9 / 1,6 / 2,3 / 3,0 / 3,7 / 4,4 / 5,1 / 5,8 / 6,5 / 7,2 / 7,9 / 8,6
so, i've got algorithm polynomial , logarithmic complexity, now, data maximum 20
polynomial:
while answer = -1 , j > 12 loop aux:= true; k in 1..j loop c := polynomial(k+1); polynomial(k) := polynomial(k+1) - polynomial(k); aux:= aux , abs(polynomial(k)) < abs (c * 0.005); --almost equal end loop; if aux aux := 19 - j; end if; j := j-1; end loop;
i've reached dead end exponencial one. give me hint? thank much.
this sounds stochastic problem i.e. find best model fit given set of discrete points. first thing determine type: logarithmic/polynomial/exponential. can study discrete derivative @ each point. if value of first derivative decreasing => logarithmic. determine if polynomial or exponential again should study derivative, time not first order. following can observed: continues derivation of exponential function exponential while polynomial 1 linear (derivative close 0). hence if after couple of derivations value close 0 => polynomial.
having determined type of model fit points model. can in c++ of eigen library , their implementation of levenberg–marquardt algorithm
Comments
Post a Comment