00:01
Okay, so the easiest way to do this is to write each for loop as a sum.
00:07
So we're going to write the first for loop.
00:12
So you have i to 1, i equals 1 to n minus 3.
00:17
So let's write it as sum from i equals 1 to n minus 3 and then sum from j is equal to 1 not 1, n minus 2i, n minus 2i to n plus 3i n minus 2i to n plus 3i.
00:44
Okay, and then how many how many things are in there? well, it's important to note that there are only three statements inside the for loop and no others.
01:02
So how many statements are inside the for loop? it's just three.
01:07
So the total number of statements so total number of statements is going to be this quantity.
01:19
Okay, which you can also write as 3 times i equals 1 to n minus 3 sum from j equals n minus 2i to n plus 3i of 1.
01:35
Okay.
01:35
So now first let's do the inner sum.
01:37
If you go from n minus 2i to n plus 3i how many ones is that? well, this is going to be just the difference plus 1.
01:48
So this is going to be 3i equals 1 to n minus 3.
01:55
And so what is the difference between the two? it's going to be 5i.
02:00
So it'll be 5i plus 1, right? because that's how many indices there are in between when you take that sum.
02:16
Okay, so you have 5i plus 1 and now we can use formulas.
02:23
So again, okay.
02:30
So again, let's split this up...