All right, next part to see is awesome. There's a video here, it's pretty good. It's definitely worth watching. There are quite a few things that kids could take away from this, so you could want students to take away from this. And I have provided those for you here, that we use recursion when the structure of the problem repeats. Some people would say that's true for loops too, but, and yeah. Okay, but it's kind of a different structure. They're going to give an example factorial, which is like, remember four factorials, 4 times 3 times 2 times 1, okay? So that's there, but you'll identify if something is recursive if you see the name of the method in the code of the method, we talked about that already. That there is this something called a call stack in the computer, that keeps track of what method we are executing. We'll find out if that's true, not only for recursion but for any methods, so which method is being executed right now. And there's a special term called the base case, which is what stops our recursive calls and allows us to finish everything up. And this image of like, they're going to represent the call stack with red cups. And they say the key is, when you call a new method you put a red cup on top of the currently executing method, so that you know that when you get done with this current method, you take that cup off and now you're going on where you had originally called the method. Just below that is a little more descriptive things. But you can use some of the video to match up to there, they're introducing factorial as a nonvisual version. That's pretty done simple. Because if you remember math, then factorial of 4 is 4 times whatever the factorial of 3 is, because 4 times 3 times 2 times 1, and the factorial of 3 is 3 times 2 times 1, or 3 times the factorial of 2. Okay, and so it's important that kids would be able to recognize these equations here as reflecting the else case. Okay, that return n times factorial of n- 1. All right, and so let me get a walk-through. We call it with 4, and then we're going to return 4 times factorial of 3. All right. Next, there is a coding activity, then I'll give you a mean because kids aren't actually asked to do anything except add one more print line there, calling factorial on 6. And so I don't think that you get much learning from that, so you could skip this if you want to make up some time because it's not like it will take much time. I just don't think it reinforces, understanding recursion at all. So to them they could just do it and they'd be like, it's magic. I know what factorial is, yeah factorial of 6, 6 times 5 times 4 times 3 times 2 times 1, they wouldn't have to understand anything. So there you are. Then we get down to the base case, our last section here. Okay, every recursive method must have one that makes the recursions stop, because if we're just calling us ourselves completely like that never ends, then we have infinite recursion, which is never intentionally done. [LAUGH] Okay. So really that's the only way, we think we really need to about this. They're not going to cover it here at all again. We're really easing our way in but your kids might say well, how do I know what the base case is? And that does become something that can become a challenge, but it should if we're choosing to use recursion because the problem structure matches it, it should kind of be stated in the structure. And that's one of the reasons there'll tend to be a lot of math examples like factorial, because math has a lot of defined things where it's like, it's defined recursively except for 0. When it's 0, the answer is 1, or when it's 1 the answer is 1, sequence is one of them blah, blah, blah. Okay, then there again, there's a couple of questions that check students knowledge of the basics identification. That's said, I'm pointing uncertainty because I missed it. Click on the lines that contain that test for the base case, not the base case. I was like, clicking on the base case, because that's truly what they're going to ask. Nope, this one asks for the test. Then it says, what is the value of n when this method stops calling itself? When we reach base case, it's going to be 1. That's whenever it's 1, we're going to stop, we're not going to be rehearsing anymore, that's our base case. And one of the things I want to point out to you here, this is not asked for at all. The students don't have to understand this at all. But I'm just pointing it out to you as the teacher, what would actually be returned in this case? This product thing, n times product- 2. So like let's say, we call product of 9. Okay, they'll do it like 9 times 7 times 5 times 3 times 1. However, what about this? What do they call product of 10? What would that do? 10 times product of 8, which is 8 times product of 6, which is 6 times product of 4 to 0. Oops, n 1 was my base case. This one's going to infinitely recurse. It's going to 2, 0, -2, -4 blah, blah, blah. You might not want to do this with your kids yet, but you could come back and show this one maybe after the next section, and I just want to point out to you what actually happens if you throw into let's say replicate, and you do this. It runs from, then replicate kicks in and well, actually the computer kicks in and it says StackOverflowError. Remember we said the call stack, this is referring to the call stack. It says, you put so many cups on, you kept recursing and kept recursing that we ran out of cups essentially, which is we ran out of memory in the stack. The stack has a fixed amount of size allocated to it on a computer, and you overflowed it, you went above the amount of space we had for it. And it don't take very long, it takes seconds. Okay, bare seconds. All right, back into C is awesome, another one where we're just being asked to identify what values of the variables this method stops calling itself. So when does it reach the base case? The answer is both 0 and 1. BunnyEars, I like because it makes some sense compared to that last product one. We are going to go into in depth and how it actually works in the next page, so you can tell kids to hold on and we'll get there, but get it, if you have zero bunnies you have zero ears. If you have one bunny you have two ears, and if you have more than one bunny, then you have two ears plus how many ears you have with one fewer bunnies. It's like cool. Okay, silly, but I like it. It makes sense. All right, so you could briefly discuss it because it makes sense. We are going to go on to the next page. All right, bunny ears, is the following method recursive? Yeah, no, it's not. Pointing out again that anything that can be done with recursion, can be done with loops. And while I said bunny ears kind of made sense, and it did make sense as we explained it, this also makes complete sense. If we had never learned about recursion before, I'd be like, how many ears for the certain bunnies I have? Okay, well, if I have is zero bunnies, it'll return total of zero, but otherwise I could loop over the number of bunnies I have, and add two every time, two, two, two. Yes, go around and count the bunny's ears