samedi 21 octobre 2017

Time complexity of nested IF statements

If we have 'm' outer IF-ELSE statements and each outer IF-ELSE statement contains 'n' IF-ELSE statements, then what would be the time complexity of the code?

For Example:

if(Condition 1){
    if(Condition 2){
        //Do something
    }
    .
    .    //'n' inner IF-ELSE statements
    .    
    else{
        //Do something else
    }
}
.
.  //'m' outer IF-ELSE Statements
.
else{
    //Do something else
}

Aucun commentaire:

Enregistrer un commentaire