I know for a fact that algorithm A runs in $\Theta(\sqrt{n})$, but how does one derive that fact?
Algorithm A
i = 0
s = 0
while s <= n:
s += i
i += 1
Here is what I am thinking. We know that A is upper-bounded by O(n), as we increment $s$ by more than 1 in each iteration. We also know that it must be lower-bounded by $\log n$, as we increment $s$ with by something less than $2^i$ in each iteration. (Correct me if I am wrong, these are just my thoughts ...).
Now, what else can we say about A? How do we derive that its time complexity is $\Theta(\sqrt{n})$?