 Hello friends, I am Sanjay Bhukta. I welcome you on Sanjay Bhukta Tech School. In this video, I am going to explain how many rules are available in a 10-year list. And I will be converting that algorithm so that we can calculate some of the values which are available in the list. So, before I start writing algorithm, let me explain this diagram which is deep representation or to contain a single list of deep representation parameters available in memory. So, here you can see start pointer is having base address of node 1. So, node 1's base address is 1, 2, 3, 4, 1. So, it is stored here. So, node 2's base address is 2, 2, 3, 4, 1. So, it is stored in this location which is next for link of node 1. And this is the information part which is that here. So, I hope you might have seen my previous video where I explained how we represent single list in memory. So, in case of single list, each node is divided into parts. First is information, second is next for link that is storing address of next node. So, this way, this is node 2. 14 is the value of 3W1 is the base address of node 3. So, and last nodes next will be having none so that we can figure out the ending point of the links. So, now let me write algorithm so that you can understand how many nodes are available in a link. So, name of algorithm is we require 3 things. So, the 4 things start, then info, then link. And then, so these 4 things, they will be required. So, next stage, this is step number 1. So, why I mentioned all these things here because whenever you will be writing algorithm in your examination. So, we need to specify the meaning of each thing that you are waiting to do with your algorithm. So, you can write start is having base address of first node. Info is the value part that is available in each node. Link is available in each node that will be storing address of next node. And counter will be having final value counter as how many number of nodes are available in a link. So, this way you can write the explanation for these. So, step number 1 will be PPR equals to start. So, start is having 1W1. So, PPR pointer will be having value as 1W1. So, we are going to use PPR so that we can move from node 1 to node 2 to node 3 and so on. Then, step number 2, start, counter equals to 0. So, we are initializing this variable as 0 because we are going to use this variable for counting the nodes. Then, step number 3 will be a loop. So, repeat steps number 4 and 5. So, if we repeat 2 steps 4 and 5, why? PPR not equals to null. So, if PPR pointer is not equals to null then this loop will be a loop. If it is equals to null then it will be null. Now, step number 4. So, in step number 4 we can write set counter equals to 0. So, if PPR is not equals to null it means link list is having a particular loop. So, we can count, we can increase the value of counter by 1 because 1 node is present in the link list. Now, when you move the PPR to the next node so that we can identify next node is available in the link list for fun. So, for that you can write step number 5 that is set PPR equals to link of PPR. So, it means we want new value to PPR but from where? From PPR link. So, PPR is pointing to this node and link of PPR is this 2001. So, this value will be stored into PPR. So, new value of PPR will be 2001. So, whenever you want to move one node to another node. So, always need to write this kind of step. And, now you can write end of loop and step number 6 will be end. So, this is now the way you are looking at the final count with the help of this loop. So, now let me complete this loop. So, this way PPR is having 2001. So, check this condition PPR not equals to null. So, it is 2. So, again we will complete the count. So, initially counter was low where PPR was pointing to 1001. So, its value was 1. Now PPR is pointing to 2001. So, counter value will be 2. Then PPR will be having link of PPR. So, PPR is pointing to 2001 and its link part is having 3001. So, this value will be stored into PPR. So, new value of PPR will be 3001. Again check this condition. It is not equal to null. So, counter value will be 2001. So, now its value is 3. Again PPR will be having link of PPR. So, this time PPR is pointing to 3001 location and its link is having null. It means it is not having address of any other location. So, PPR will be having PPR as null. Now if you check this condition. So, it is 2. PPR is equal to null. So, loop will repeat when PPR is not equal to null. But this time PPR is equal to null. So, this loop will be calculated and finally you can see contract variable is having address P. So, this way I hope you understood the algorithm. How to write algorithm to found nodes which are available now? So, you can write this algorithm in your examination. Now, if you want to write this algorithm some of values which are available here at 20 and 30. So, by changing one statement in this algorithm you can use this algorithm. So, in case of count here you can write some. Here I can use the variable as or you can use some also and set as equals to 0. And in case of count equals to count plus 1 you can write some equals to some plus. And this time you need this value that is info. Inform PPR. So, you can write this. So, always PPR is pointing to a vertical node and if you want to access the information part similar to link like we did for this link of PPR. So, if you are writing link of PPR it means you are accessing this location and this location value will be added into some algorithm whenever you are moving forward in the link list. So, this way all the information of PPR will be added into some and finally some variable will be added calculated some. So, here my mistake I mentioned some. So, I am writing variable link some here also. So, this way I hope you understood how we can calculate some of the values which are available in the link list. So, in this video I explained you two simple algorithms how you can write those. So, I hope you understood how we can implement these algorithms in data structure. If you want to watch like how we can write C program based on algorithms for signal in this. So, you can go to description of this video where you can find link of playlist and you can follow that playlist and you will get to know how we can convert link list algorithm into a C program. And I hope you understood whatever I explained in this video. Thank you for watching this video.