954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

time complexity

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!

aimee_jc
Newbie Poster
5 posts since Jul 2009
Reputation Points: -1
Solved Threads: 0
 

no help for multiposting homework kiddos

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: