 What's up guys, my name is Michael and welcome to my YouTube channel today. We're going to go over print in reverse so basically given a link list of Data we're gonna with a Data of one two three. We're just gonna print three two one. Okay, so I'm gonna do this recursively and I'm not gonna use any data structure because uh, yeah I think that's what they want us to do so here. I'm gonna explain how to do it recursively. So what we're gonna do is um, We're just gonna keep going next Over and over again until we get to the end. Okay, so if I'm a reverse print this I'm just gonna keep going next over and over again till I get to the end Then um, once I'm at the end, I'm just gonna return and go back and every time I go backwards I'm just gonna print out the statement whenever I go backwards. So here's basically the gist of the code So, uh, yeah, maybe I'll just rewrite this Actually, I just think I'll just explain so yeah Here's what we're gonna do. We're gonna if our current list is Null then we return that means we reach the end of the list What I'm doing is I'm gonna keep on going to the next recursively call this function until I reach the end Right. So when I reach the end, that's when our list is null. So then I return otherwise, I'm gonna Just recursively call this function over and over again, and I'm gonna pass it next Right, so I'm just gonna keep going and keep going and going so I reach the end Right, and if it's not if it's null point of that return. So now whenever you return You're gonna go backwards on the stack. All right. The stack is basically like the The level of memory. So after my recursive call, I'm going to print out the data The The list of did the link list data, right every time I go backwards So then the after your recursive call stack goes backwards over and over again. We're basically printing backwards So, yeah It's pretty much the gist of the code If I want to show you guys how this basically works I'll show you guys right now real quick. But then I actually have to go soon. But um So, let's say let's say we have one two and then three So this is a link list, right? So there's one two and three and this goes in all So what I'm doing is I'm going to keep going to the next on Recursively calling this. So is this a null? It's not right. So I'm gonna recursively call this passing the next So whenever you go to the next you're actually pushing of the stack frame So the stack frame now has like two Right, then is this null? It's not so I'm gonna go next recursively called to the stack frame So I'm gonna push three. All right now. I'm a null. Is this null? Yes, it is. Did I return? When I return my stack frame is gonna go back to this three and what I'm gonna do here is I'm going to print the data Yeah print the list nodes data Here Afterwards so and this is gonna print three and then after your return calls stack from goes goes back this stack gets Off the stack and then now we're at two now. We're gonna print try to print two. So once you print two This color goes out and I actually forgot to put one on the stack But yeah, then after this one goes out and this call the stack from goes back We're gonna print one and this goes empty. So we basically printed three two one So yeah, that's the juice of this code. I hope you guys enjoyed this video right com subscribe. That was like it So yeah, this is printed reverse and yeah, I got to go now. Peace