 What's up guys, Mike TheCode here. Today I'm going to teach you guys how to actually read an algorithm textbook. So let's get right into it. By the way, I got this video from unobserved textbook like a sponge. I'll put that link somewhere down there in the description. So most of the stuff what I'll be saying will be related to that. What I'm going to do is I'm going to explain how to actually read an algorithm textbook. It's more similar to how you were to read a math book and less similar to how you would read a novel. Okay, so let's get right into it. So here we have a book introduction algorithms by CLRS. So this is like the golden book of algorithms. Okay, what most people use. There's all the algorithm books you could use. This is just the one that I'm going to give an example for. So let's say we're in this book and I want to learn insertion sort. Okay, so this is getting started. Okay, so what do I do first? Number one, do not actually read anything first. What we're going to do is we're actually going to directly skip all the way to the end. Okay, so we're going to skip to the end. And what we're going to do is we're going to read the exercises first because if we read the exercises, generally the exercises explain basically when we're doing the exercise actually tests our knowledge of the subject. And then if we actually do the exercises and we'll actually remember, try looking at the exercise first and finding the solution and the text and do these hard problems. We're more likely to remember the text, right? Generally exercises are there to help you remember the material. And so yeah, that's what we're going to do. So here we're going to read the exercise first. So in this case, we're going to illustrate the operations and insertion sort on this array. This time rewrite the insertion sort procedure to sort non-increasing instead of non-decreasing order. Considering the searching problem we have given an array of value and V. In the index I is AV is AV if the specialty does not appear in A. Okay, so now here write a linear search that scans through the sequence looking for V. Use loop invariant, prove your algorithms correct. Okay, so these are three problems. And the fourth one, the last fourth problem is consider the problem of adding two binary numbers. Storn two element arrays A and B. The sum of the two integers should be stored in binary form from the N plus one element in C. State the problem formally and write pseudocode for adding the two integers. Okay, so just after reading these exercises. So what do I have to do? So let's say, well, first of all, the first problem I probably have to look for how to actually use insertion sort. So I would actually need to learn how insertion sort works on the array. Second one problem is probably have to learn how to write the insertion sort procedure. Rewriting it in terms of decreasing order instead of increasing order. The third one is just to try to write a linear search algorithm. So I probably need to find a linear search inside the text. The fourth one is adding two binary digits and storing them into a final array and writing a pseudocode for it. So yeah, that's basically what I'm doing. I look at the exercises and I'm going to try to write, think about in simpler terms of what the question is asking. Understand what the question is. So if you could just break down the problem in simple terms like you don't need any of these garbage nonsense, right? Then we're more likely to do the problem. Okay, so now that I've read all the exercises, I'm going to look back. Okay, and then I'm just going to flip through these. Okay, I'm going to go back to the front and I'm just going to flip through. So I'm going to just flip through and see what I have to do. So oh, damn, we have cards here. Okay, and then we have this algorithm of solve the sorting algorithm. You see this format that might, this format might be the one that will help us for our linear searching problem. So maybe we'll look through that. Here we have just have these stuff. Maybe this is explaining the algorithm. Oh, okay. Here we have the insertion sort algorithm. So it tells us the insertion sort algorithm and loop invariant. Okay, so maybe we have to do stuff here. Okay, we have maintenance and terminations. Just flip it through with it. Just literally just flip through it. Flip through it. Okay, pseudo code convention. Okay, so maybe we need to do stuff here. So here we're just going to flip through it. Okay, so now we flip through it. Now what we're going to do is we're going to read the titles of every single thing. So here go back to it. All right, so we're going to read titles or boldface. So now we're going to read insertion sort. Okay, so we definitely know this is probably insertion sort sorting problem. Okay, so maybe this is like the format. And remember that previous problem that I think the third problem, we might need to go back here to in order to find it to solve the problem this solution. So when I actually have to look back here. Okay, insertion sort here is insertion sort. And here we present the pseudo code of the algorithm in place. Okay, so I might need to know what in place is. So remember, we're looking at boldface now. Okay, so here, okay, for loop. So I might need to look at a for loop. Okay, so then okay, this is a good diagram. Maybe this is explaining how insertion sort works. The pseudo code for to whatever loop invariance correction of insertion sort. So this is a, this is loop invariance in the correctness of insertion sort. And remember that was one of the problems that we had to do. This is problem four. So if I read through this, this probably would help me understand problem four. Okay, so then these are like the steps of the algorithm probably. So here we see initialization maintenance termination. So I might need to know these. And then after they have these, I'm guessing this is defined what there are. They're just showing how this works on the algorithm. So initialization maintenance termination. Okay. Oh, and then we have pseudo code of convention. So explaining how what you're supposed to write in the pseudo code. And we have four while while for repeat until if else. Okay, these are job four. Okay. So we have that down to four while. Okay. So we have this. Okay. Objects attributes. Okay. Pat procedure by value. Okay. Maybe we need to know that I'm sure though. Okay. Return most return return short circuiting. We might need to know that. I'm not sure. Error. Okay. So now that I flipped through and I read the titles of everything read the bull face. Now. And I read the titles. I'm going to actually going to go back and just read the first sentence of every single paragraph. Because that way I'm more likely to understand it. Okay. So I'm just going to read the first sentence of every single paragraph. That's going to take a long time. So I'll probably come back to it and do that, but where you're going to read the first sentence of every single paragraph. Okay. So now let's say you are we already read through the first sense of every single paragraph. Then what we're going to do is we're actually going to just sit down and do these exercises while we're looking back to the textbook and try to find how to do them from reading, reading the textbook. Right. So yeah, we're just going to do these exercises. There's only four of them. And then after that, we'll go back to the textbook and yeah, we'll just do it after you finish reading the problem and finishing doing the exercises. All you have to do is look online for if there's any solutions for the problem and just see how different yours is to the solution. And then if there isn't, then you mark it as right. And if it's wrong, try to learn why you got the problem wrong. Okay. And don't read. Remember, don't read from front to back. You could just try to pick a chapter, any chapter, skip through it. You could jump around chapters to try to learn material. You don't have to go from start to end. So yeah, like if I want to learn dynamic programming or even heaps property, I just skip to it and just do the exercises and yeah. And then that's it. I hope you guys enjoyed this video. Rate, comment, subscribe. I'll check you guys there. And yeah, by the way, if there's any issue with like certain math notations that you don't know, try to look them up on other resources to see if that will help you. Yeah. Rate, comment, subscribe. I'll check you guys later. Peace.