function projection($x1, $x2, $x3){
//$x1 = first year
//$x2 = second year
//$x3 = last year
if (($x1 != "") ||($x1 != 0) && ($x2 != "") ||($x2 != 0) && ($x3 != "") ||($x3 != 0)){
//MODIFIED EXPONENTIAL
$b = ($x3-$x2)/($x2 - $x1);
$a = ($x3 - $x2) / ($b-1);
$c = $x2 - $a;
//prediction output
$d = $c + $a*($b*$b);
}
//year
$j = 2009 - 2007;
//LINEAR GROWTH if second year is empty
if (($x1 != "") ||($x1 != 0) && ($x2 == "") && ($x3 != "") ||($x3 != 0)){
$b = ($x3 - $x1)/( $j);
$d = $x3 + $b($x3 - $x1);
}
//LINEAR GROWTH if third year is empty
if (($x1 != "") ||($x1 != 0) && ($x2 != "") ||($x2 != 0) && ($x3 == "")){
$b = ($x2 - $x1)/( $j);
$d = $x2 + $b($x2 - $x1);
}
//LINEAR GROWTH if first year is empty
if (($x1=!= "") && ($x2 != "") ||($x2 != 0) && ($x3 != "") ||($x3 != 0)){
$b = ($x3 - $x2)/( $j);
$d = $x3 + $b($x3 - $x2);
}
return $d ;
}
help please! what is the time complexity for this code?
thanks!