 So I'm going to give you a walkthrough of the A star algorithm Specifically to kind of give you a good idea of sort of what to expect when you're asked to do this You may be in 411, but since this is YouTube you may be in some other class And so you may have to demonstrate a star And so well, I'm gonna walk through it because that way you get a sense of like how much you got to practice And if you're thinking about this from like a testing perspective or you know How much time you need to kind of prepare for so I've already drawn out a little bit of my starting kind of point I want to go from Memphis to Seattle so we're working off of those same numbers. I encourage you Either pause the video work it out and check on literally just skip over the video and then check my solution or You're more than welcome to You know mute me turn on lo-fi beats and work through it or listen to me ramble on the entire time as I sort of try And explain it in one go one take with no mistakes Anyway, so what I like to do is I like to draw this sort of four-column grid with a gh and f sort of in this kind of position That sort of is my way of processing this as I sort of go through it Again since we're dealing with sort of Memphis is my starting point. It's the first thing in the queue We don't really consider that a Step we we just sort of acknowledge that we have to do it but it gets removed out of the queue and We have to look at one two three possible routes So I'm gonna just work off of out of or out of alphabetical order or whatever I see You know first it again doesn't really matter But we see that it's Atlanta to Charlotte or Dallas Fort Worth Each one of those again has their own step to them. So one of the things I like to do this again Just helps me sort of make sure I'm reading everything correctly as an instructor. It's kind of important I get things right So that's the worst 384 you've ever seen six six one nine And then four five two. All right. Well again, I'm working through these as I go This is actually one of the reasons why I sort of have things written out and you'll see in a second one of the little tricks I do So we've got in we've added all of these different pathways I do like to include where I came from But I just sort of don't have the space for it. But again, let's see. So 384 Charlotte. Oh my goodness. That is the worst See six one nine Ray Mysterio would be highly disappointed in me Six one nine and then Dallas Fort Worth was four fifty two Four. Okay. Well again, so that's our G That's just how many how much would it take to make this step? But H is asking us how much further do we have to go? So we look at Atlanta. It's two six three seven Let's see. Charlotte is two seven nine four There we are and then Dallas Fort Worth is two one zero nine Now one thing in particular that I will go ahead and say Have a calculator ready. None of us are good at math. Just Have a calculator if you have to do this by hand your instructor is a cruel victim addictive person who I'm not gonna keep talking bad about your instructor. Either way, I plugged in for Atlanta. Okay, it is three thousand three thousand Twenty one Then we're gonna do six one nine plus two seven nine five. That's 34 14 so 34 14 And then finally Dallas Fort Worth 25 61 so 25 61 so You know in my uh slides. I owe magic You know did stuff and uh my You know the high the cheapest one moves to the top I don't really have that luxury when I'm writing it out and that's sort of why I'm sort of walking through it in this sense because I've written some out and clearly I've got to you know, make a decision Well, what I like to do is again, I sort of do my comparison. I do my eyeball I see that uh, Dallas Fort Worth is sort of the cheapest and I like to label it like this So add a one, uh Because it's the first thing that gets removed from the priority queue. Yes. Technically Memphis was the first but Nobody cares about that one So again, Dallas Fort Worth was the first thing that got removed. It's the first thing that gets considered Dallas Fort Worth only has one step, which you know saves me a lot of heartache, but uh from there we can go to Denver All right. Well Denver was uh, let's see. So it's gonna be 795 And as we build that out on this end. So Denver That's gonna be let's see. So this is again why I sort of like to add in the calcs along the way So I because that's going to be Uh, I'm gonna skip over that actually for right now. So just do the one three one seven handy dandy calculator. I see that again, I've got To get to Denver. I had to first go from Memphis to Dallas Fort Worth. So 452 plus 795 Dallas Fort Worth to uh Denver. That's gonna make its g 12 for 74. So 12 12 Not 74 47 All right. Well, I gotta take that 12 47 plus that 13 17 and that's 25 64. So 25 64. All right. We're off to a good start. We see that uh Denver, uh from Dallas Fort Worth is the next cheapest. So again, this is how I like to operate it Again, this allows me to not have to worry about embracing, uh things, you know On that list the entire time I can just sort of, uh work through the algorithm a little Little faster. Um, I do have to scroll a little bit down. So Let's see. So from Denver Denver has only one pathway as well To or d and this is where we're gonna get some headaches and heartbreaks. Uh, so that is 16 62 Again, that's or d Or d's path is 2043 And to calculate out the path cost the g of going from Memphis to or d That's 452 plus 795 plus 1662 Uh, 2909 2909 Let me make that nine a little bit better Then I'm going to walk through that. So that's 2909 plus 2043 Uh, 4952 4 4,000 Let me 4,000 4,952 So this is, you know, some of the heartaches that you may run into when you're sort of working through a star is that You know, you know, oh this I think I'm more than likely sure that this is the pathway Uh, but I have to do considerations beforehand. I still have to see what's the next thing in the queue Well, it is going to be Atlanta Atlanta Has to be considered first So we have to expand out Atlanta and yes, Atlanta has one two three four routes that have to get Math out Yes, welcome to It that that's welcome to it So you draw them out And I'll try and leave some room for charlotte just in case we got to go there Let's see. So Atlanta can go to mci Atlanta can go to clt Atlanta can go to rdu And it can go to Orlando You can see I'm already abandoning that order trying to keep things in alphabetical order here. Um, that's again As you start reading these graphs it gets a little harder to do it in alphabetical order But either way, uh, so we add in mci This is again why I like to include, uh, where I came from Because as you can sort of see these are We may start repeating ourselves if you will Rdu Orlando Let me uh Drop that line down a little bit. All right. Well, again, we've got to do the same song and dance. So mci that was 799 To charlotte is 244, uh rdu for that's not a four that's a 407 and then Orlando for 438 Oh, that was There we go. Okay. So we again walk through it aka pull out the calculator and start working through that math So, uh, the first one is again. Well before I do that one. I'm gonna drop out the h's that's just gonna save me some heartaches Uh, let's see. So mci mci is 1837 There's your seven, uh clt 27 95 Uh rdu where are you? 2844 and then, uh, Orlando 30 74 Okay, so again, we bust out the calculator and we start doing math So, let's see, uh, that's 384 plus 799, uh, 1183 1183 I'm gonna go ahead and do the math on that one. So 1837 3020 3020 Let me make sure to make that a zero so I don't accidentally screw up later on So now we're doing clt 384 plus 244 628 628 Plus 27 95 34 23 34 23 rdu rdu is 791 791 Plus 24 284 36 35 36 35 And then Orlando is 384 plus 438 822 822 Plus 30 74 38 96 38 96 Okay, so again, we go through the same process again. We're looking at it MCI so Atlanta to Kansas City is our next Consideration there's our four So we expand out. There are two possible routes from Kansas City. So Boom We can go to Salt Lake City Or what was the other one? Uh, St. Louis St. Louis is 248 And then That's 1089 Okay, well, guess what you add them in so Salt Lake City St. Louis Uh, let's see. So Again, I'll do the pathways. So from St. Louis. Well Salt Lake City 840 And then St. Louis 2083 Okay, so Salt Lake City, uh, again, busting out the calculator. Let's do the maths Uh, I mean I Shum it up just a little bit so I can see everything at once 384 plus 799 plus 1089 2272 2272 Uh plus 840 31 12 12 St. Louis St. Louis was 384 plus 799 plus 242 48 14 31 14 31 Plus 2083 35 14 35 14 Okay. Well again, we look at which one is our cheapest route. Uh, so if we're digging through here, uh, let me actually cross out Kansas City If we look we see that the cheapest next route is Salt Lake City So we go through that process. We see that it has two pathways from ord and Salt Lake So again, we expand those out so Salt Lake City can go to ord Or the promise land our goal Seattle What were the paths for that? Uh, let's see 1415 and 840 so 840 and 1415 And let me add that little circle so we get that going on there I am just going to do it down here. So F G So let's see ord To Seattle Uh, let's see the h's for those. I remember uh to get to Seattle It's going to be a zero right because you know, how much further do I have to go from Seattle to Seattle? Nothing Ord, this is actually so this is one of the reasons why I like again to include where this came from Because that ord is not the same as this ord that we have from Denver All right, that's from Denver But we also have the one from Salt Lake City Either way, uh, I digress let's see ord again Is 24 or 20 43 We bust out the calculator. Uh, I'm going to move you over here Let's see. So we've got uh, 384 plus 799 plus 10 89 plus which one am I doing first 1415 36 87 Oh Right 36 87 36 87 Plus 20 43 5,730 5,730 And then to Seattle from uh from Seattle, it's 348 79 9 10 89 plus 8 40 3,112 3,112 3,112 Okay, so I look at my scores again and I have to cross Salt Lake out because it's there and I'm going to make a strong assumption here that oh, what do you know? Seattle from Salt Lake City Is the sixth thing removed from our queue? We found our pathway And so again, it would be Seattle from Salt Lake City From Kansas City to Atlanta to Memphis but This is sort of the kind of you've got to do this you have to consider these Right. Oh, you know, we thought that going Dallas Fort Worth to Denver to O'Hare You know, Chicago would have been the cheaper way because that was where we started But as we sort of continued down that Denver to Charlotte Chicago pathway, right, that's Just too big of a step in the opposite direction Even though it's the only pathway and it was the first ones we were doing It's not good enough. So even though oh, we considered this route It actually turned out. Hey, maybe if we take a little bit of a step back We can reach our goal. So hopefully that gave you a walkthrough Compare your answers to mine See if I did anything wrong. Leave a comment in the Comments down below if I did give it a thumbs down and never share this Either way, again, hopefully this was a star walkthrough for you