 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to tell you a brief introduction about Singly link list. Before start, if you want to watch more videos related to link list and data structure and algorithm, so you can go to description of this video where you will find link up playlist and you can follow them. So, starting with this introduction, link list is a sequence of data structures which are connected together via links. So, in case of array, we have sequential memory location and we process locations with the help of indexes, but that doesn't happen in case of link list. So, in case of link list, if you want to move from one location to another, so we use links and addresses. So, second point says link list is a sequence of links which contains items. Each link contains a connection to another link. So, link list is the second most used data structure after array. So, similar to array, we can store values in link list as well. So, this is the simple diagram through which you can visualize or you can create an imagination in your mind like how link representation creates in memory. So, this is the head which will be storing the base address of this node. So, in case of link list, we create nodes. So, here in this diagram, you can see three nodes are available. Node one, node two and node three. And each node is internally divided into two parts. First is, first will be storing data, value or item. And second is known as pointer to next node. So, this node will be storing address of another node. So, first node, next pointer will be storing address of second node. Then second node, next pointer will be storing address of third node. Then third node, next pointer will be storing address of fourth node, but fourth node is not available. So, third node, next pointer will be having none. So, this way, whenever you create a memory block, so this node will be created and it will be linked with this link representation. So, in case of link list, we don't allocate memory as a whole. So, whenever we want to store any value, first we create a node structure and then we decide where to insert that node. Either in the beginning or at the end or in the mid of the link list. So, this is the basic representation of link list. Now, we need to discuss some advantages and also disadvantages of the link list. So, first advantages are, so link list is a dynamic data structure which can grow and be grown by allocating and deallocating memory while the program is running. So, we can increase and decrease the values or you can say size or memory of link list. So, if we want to insert any value, we can create a node and we can insert that into link list. If we want to remove any value, then we can delete that location or you can say we can remove that node or memory from the link list so that it can be deallocated. So, this way we can do insertion and deletion operations. So, second point says insertion and deletion of node operations are easily implemented in a link list because in case of array if you want to insert any element. So, we need to shift all other elements like if you want to insert any element at the beginning. So, you need to shift all the elements by one position. But in case of link list, you don't need to do this because you can just manage the addresses and you can easily insert any node or any number without moving all the nodes or values to right inside or left inside. Then third point says dynamic data structures such as tags and use can be implemented in a link list. Then fourth point, there is no need to define an initial size for a link list. So, in case of array, we need to put the initial size or if we allocate array dynamically, then also we need to put initial size by reading value from the user. But in case of link list, we don't need any initial size. If you want to store a value then create a node and then store the value and put that node in the link list. Then next is items can be added or removed from the middle of list. So, this we can do then backtracking is possible in case of two way link list. So, if we have two way link list, in that case we can either move from left to right or we can move right to left. So, backtracking is possible in that case. So, these were the advantages. Now, let me discuss the disadvantages so that you can know like what are the drawbacks of using link list. So, they use memory more than arrays because of the storage inside their pointers. So, to store one value we require two blocks. So, additional amount of memory is required as compared to array. Second point says nodes in a link list must be read in order from the beginning as link list are inherently, sorry, inherently sequential access. So, in case of array, we can directly access a particular index or you can say we can access any location directly but in case of link list you cannot do so because you need to traverse each and every node one by one and then you can access a particular location. So, this is the drawback. Then third point says nodes are stored in continuously or greatly increasing the time required to access individual elements within the list, especially with a CPU cache. So, this is another problem. Then last is difficulties arises in link list when it comes to the worst traversing. For instance, single link lists are cumbersome to navigate backwards and while doubly linked lists or two way linked lists are somewhat easier to read, memory is consumed in allocating space for back pointer. So, there is one advantage with two way or doubly linked lists like we can backtrack but the drawback is we need extra memory to store the back pointer. So, these all are drawbacks of using link list but you need to decide your priority like you can prefer array or you can prefer link list. So, if you don't want to allocate initial memory then you can prefer link list but if you can allocate initial memory or you can visualize like how many blocks you need to allocate. So, in that case you can choose array but you are not sure like how many memory blocks are required and dynamically you want to increase or decrease your memory size so in that case link list will be better to use. So, both have their pros and cons arrays and link list so choose a particular data structure wisely to store your data. So, I hope you understood brief information about link list so watch my next video that is available in the playlist and link is available in the description of this video where I will compare in the lecture like the difference between static array, dynamic array and then link list. So, with the help of board and pen I will be drawing each and everything on the board and you will be visualizing the things like how we created one variable then we create static array then we create dynamic array and then create link list. So, these are step by step modifications or memory allocations I will be explaining you so watch that video too so that you can understand the requirement of link list. So, I hope you understood this brief introduction of link list. Thank you for watching this video.