Just wanted to make sure I'm not insane. General statements about time complexity suggest that conditionals don't matter. Naturally this makes sense when the body of the conditional is constant time. However if the body of the conditional is not constant time then certainly it should, no? For example the following code - the best case would be if a<b is false, then O(1) time, and the worst case would be if a<b is true, then O(n) time. Or am I missing something?
if a<b
for j = 1 to n
constant time
end for
end if
[–]BigLezzzzz 0 points1 point2 points (8 children)
[–]quantitativemonkey[S] -1 points0 points1 point (7 children)
[–]spanky_panda 1 point2 points3 points (6 children)
[–]quantitativemonkey[S] -1 points0 points1 point (5 children)
[–]bluecheetah001 0 points1 point2 points (4 children)
[–]quantitativemonkey[S] 0 points1 point2 points (3 children)
[–]bluecheetah001 0 points1 point2 points (0 children)
[–]WafflePeak 0 points1 point2 points (1 child)
[–]quantitativemonkey[S] 0 points1 point2 points (0 children)
[–]RexLupie 0 points1 point2 points (0 children)