Time Complexity of nested if, compared to multiple cases in while
<p>I am looking at the time complexity of various solutions, and since I am not much of a math lover; I can't quite figure out the best time complexity for my call.</p>

<p>The problem is that I am not sure if it takes longer to get trough a while loop with 1 statement, and nested if-else, or if it is better to remove the nested if-else and add the check in the while loop.</p>

<p>As generic example would this perform faster</p>

<pre><code>while a&gt;1 and b is True
    if x is True:
        a -= 1
    else
        a += 1
</code></pre>

<p>instead than </p>

<pre><code>while a&gt;1:
    if x is True:
        if  b is True:
            a -= 1
        else:
            a += 1
</code></pre>

<p>I recall that nested if result in O(N^2), while a simple while loop has complexity O(n), but what happens when the while loop has to check multiple statements.</p>