Which of the following two is more efficient from a processing / time complexity point - sorry just trying to get my head round time complexity and potential impact on computer processing time:
Option 1
if (condition1) {
function1();
function2();
}
else {
function3();
}
Option 2
if (condition1) {
function1();
}
else {
function3();
}
if (condition1) {
function2();
}
else {
function3();
}
Assuming function1() and function2() are both O(N), I think both option 1 and option 2 are O(N) time complexity. However if we could measure how quick both options run on the same computer, would option 1 be quicker or will there be minimal difference?
Thanks!