-3
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!

Edited by Nick Evan: Added code-tags

Votes + Comments
Fail.
Did you have to start 5 different threads about this stuff??
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by jwenting
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.