CyberV_ASR / VideoMMMU_ASR_large /Engineering /test_Computer_Science_227.mp4.txt
marinero4972's picture
Upload 301 files
0a5fd4d verified
[0.78s -> 15.06s] Hello everyone, and welcome to this video on recurrence relations. So in this video, I'm going to show you how to solve the following recurrence relation in terms of n by using the iteration technique.
[15.76s -> 21.01s] Now the recurrence relation that I have is in blue in the blue rectangle
[21.33s -> 34.58s] first I have the recursive case T of n which states that T of n is equal to T of n minus 1 plus 4 and then underneath it
[35.12s -> 45.04s] I have the base case, or stopping case, which states that when n is equal to 0, the function t is equal to 1.
[46.06s -> 59.18s] Okay, so to get started we're going to first create two columns the first column I will call K And it will contain the number of iterations
[60.02s -> 71.18s] the second column I will call T of n and it will contain the recurrence relation
[71.73s -> 79.31s] At each iteration so it shows what that recurrence relation looks like at each iteration
[79.95s -> 88.18s] Alright, so to start this we will start with our first iteration so under K. I will put the number one
[88.66s -> 101.71s] what does the the function look like at this first iteration well it looks like what we already have stated in the problem so I'm just going to rewrite the function
[102.35s -> 116.85s] So I'm going to put here T of n is equal to T of n minus 1 plus 4. Okay? And now we can go to our second iteration.
[117.74s -> 127.06s] But before we get to our second iteration, we need to know what T of n minus 1 is equal to.
[127.92s -> 138.42s] And that's easy enough. We can just plug in n minus 1 into the original t function or the original t of n function.
[139.92s -> 152.91s] To figure out exactly what this is equal to and I'll show you what I mean by that so T of n minus 1 is equal to
[154.16s -> 168.56s] T of n minus 1 minus 1 plus 4 Okay, and then if I simplify this a little bit I get T of
[169.20s -> 173.90s] n minus 2 plus 4.
[175.50s -> 190.48s] Okay, so now that means I can substitute T of n minus 2 plus 4 for T of n minus 1 in the second iteration And that's exactly what I'm going to do so for the second iteration under column K. We're going to put 2
[191.25s -> 204.72s] And now the function t of n is equal to, I'm going to put this in blue, t of n minus 2.
[205.10s -> 210.93s] Plus four and then I have to add that other four
[217.94s -> 232.19s] All right, so hopefully you see that T of n minus 1 has been rewritten in blue in the second K iteration and Has become T of n minus 2 plus 4? All right, and then that
[232.19s -> 238.29s] 4 right here comes from the 4 right here
[244.43s -> 252.34s] So now to get to the third iteration we need to know what T of n minus 2 is equal to
[252.72s -> 266.74s] And that's easy enough just by plugging in n minus 2 into the original equation, kind of like what we did before for t of n minus 1. All right, so t of n minus 2.
[267.06s -> 278.38s] Is equal to T of n minus 2 minus 1 plus 4 and if we simplify that we get
[278.80s -> 286.32s] T of n minus 3 plus 4 Okay
[286.90s -> 301.58s] So now I can go to the third K iteration, so I'm gonna put a 3 under the column K And I'm gonna rewrite our function T of n So T of n is equal to T of
[301.87s -> 313.97s] minus 3 plus 4 and then I want to add in the 4 from the previous iteration so that's coming from here
[315.86s -> 328.24s] Alright, and then when I add in another four from the first Kate iteration, which is coming from there Okay
[328.66s -> 336.21s] Now I'm going to actually stop here because I already see a pattern and that's exactly what you want to be able to see a pattern
[337.26s -> 350.66s] So if you don't see the pattern yet, keep doing these K iterations until you do see a pattern. But I already see the pattern, so I'm going to just stop here. And I'm going to make a guess. So for some arbitrary...
[350.66s -> 362.96s] value that we're going to call k, the function t of n will be equal to t of n minus k.
[364.94s -> 376.94s] Plus 4 times K All right, this is also called the general
[378.86s -> 393.81s] form all right now to get this form in terms of n we need to know when it stops
[394.77s -> 408.21s] So I am going to create a new sheet. And I'm going to rewrite that general form. So I'm going to type general.
[409.42s -> 422.22s] form here and the general form is T of n is equal to T times n minus K
[423.34s -> 437.42s] plus 4 times K and Like I said we need to get it in terms of n so we need to know when it stops And know that it stops on the base case so if I go back to
[438.19s -> 452.46s] the other page, then we can see that the base case states that T of 0 is equal to 1. And again, that's right here.
[457.26s -> 471.70s] So now I can go back to our general form page. And what this tells us, it tells us that we want, I'm going to put here we want.
[474.70s -> 485.49s] I'll make it look a little nicer. We want t of 0. So.
[487.22s -> 499.09s] T of n minus K needs to be equal to 0 and Why is that well that's because that is equal to 1 right?
[503.15s -> 516.27s] So we need n minus k to be equal to 0 Then that means that we need n to be equal to k and of course that means that k is also equal to n
[517.20s -> 527.38s] All right, so now let's rewrite this equation in terms of it So now we get t of n is equal to
[527.63s -> 538.99s] T of n minus n. We're just substituting in the variable n for the variable k.
[539.82s -> 549.90s] Alright, so we get T of n minus n plus 4 times it And now if I simplify this
[550.90s -> 556.62s] I get t of 0 plus 4 times n.
[557.20s -> 566.61s] And we know that t of 0 is equal to 1 so we can simplify this a little bit more and we get 1 plus 4 times in
[567.09s -> 573.87s] And then I'm just going to rewrite it one more time. So we get 4n plus 1.
[578.64s -> 584.11s] This is what we believe to be the closed form
[600.14s -> 613.65s] Alright, so what is this in terms of big O? Well, 4n plus 1 belongs to big O of n.
[618.86s -> 632.88s] Now, how do I know this? Well, that's because I have lots of experience with this. But I do have videos showing you how you can prove this as well. So be sure to check those out. I will put them.
[632.88s -> 635.25s] the description below
[635.60s -> 650.06s] I hope that you all enjoyed this video. Please leave any likes, any comments, any questions, any problems that you would like for me to solve in the future. Please leave them in the comments below. And I appreciate you all watching the video.
[650.06s -> 652.53s] And I will see you all in the next one.