Hi I\'m trying to analyze the time complexity of this algorithm but I\'m having difficult unraveling and counting how many times the final loop will execute. I realize that the
It is O(n).
1 + 2 + 4 + ... + 2^N == 2^(N + 1) - 1.
The last loop, for a specific j, executes j times.
And for a specific i, the inner 2 loops execute 1 + 2 + 4 + ... + i times, which is equal to about 2 * i.
So the total execution times is 1 * 2 + 2 * 2 + 4 * 2 + ... + N * 2, which is about 4 * N.