0

I've been working on getting the Big-Oh notation for this code segment a couple days now and I can't figure it out. I've most likely come across the right answer but I can't convince myself it's right. What's the Big-Oh notation for the following code and how do you arrive at that answer?

```
x = 1;
for (int i = 0; i < n -1; i++) {
for (int j = 1; j <= x; j++)
cout << j << endl;
x *= 2;
}
```

My work so far:

inner loop: executes x+1 times ; outer loop: n-2 times

therefore,

Summation of x+1, where x = 2^n, from i = 0 to n-2 gives the amount of executions for the inner for loop

I'm not sure how to convert the summation of 2^n to a form where I can get the Big-Oh