 Hello and welcome back, I am Rajesh Argiddi from CAC department of doubly distalable. Today we will focus on data structure topic that is link list in which we have singly linked list, doubly linked list, singly circular linked list and doubly circular linked list. Let us focus on doubly linked list. The learning outcome of today's video at the end of the session student will be able to explain the doubly linked list data structures. Let us see what is doubly linked list. It is a link list which has two pointers through which the list can be traversed in both directions that is in forward direction and in the reverse direction. As we know that in singly linked list the traverser was in only forward direction. So we used to traverse only one direction but in doubly linked list we can traverse forward as well as reverse. Doubly linked list provides a natural implementation of the list abstract data type, nodes in the doubly linked list store three parts. The first part is called as a data or element, second is called as a link to the previous node and third is called as a link to the next node. In data or element whatever the data we want to store it may be integer, character or any data type that can be stored in the data part. And these two links link to the previous node and link to the next node. Let us focus on, let us look at this diagram. If you look at this diagram the middle part which will store the data, actual data may be the integer, character, float, double and the left part of this data which left part has called as a previous and the right part of this data is called as a next. This previous means that it is the storing the address of the previous node or it is a link provided to the previous node. And this part will store the address of the next node or it is linked addressing to the next node. So in a list, suppose there are more number of nodes are there. So every node will have previous link and next link, data part and element part. This is called as a node. Now if you look at the entire linked list, it will look like this. There are five nodes are there. The first node which stores the value 10, second stores the value 20, third stores the value 30 and the fourth one stores 440 means only four nodes are there, not five. So these are called the nodes. So middle part will be storing the actual element or a data part. Now every node has two pointers that is linked to the previous node. This is linked to the previous node. Now since it is a first node of the list, which will be pointing to the header, header part, which will store the address of the entire list. And the right part of this 10 data, which will store the address of the next node that is 20. Similarly, this 20 node will have three parts. In the middle part, it will be storing the data 20 and the left part, which will be linked to the previous node that is the first node. And on the right-hand side, this will be storing the link to the next node that is third node. Similarly, third and fourth are stored in this way. And the last node, in the last node, there is a data called as a data 40 stored. And left link is having address of the previous node that is third node. And here it will be storing the address of the next node. Here this is since it is a last node, it will be addressing to the trailer. It will be addressing to the trailer node, which will store the address of this particular node. And this header part is also storing the address of the first node of the address of the first node. So special header and trailer nodes are used to denote head and tail positions in the link list. Now, sentinel nodes, to simplify programming, two special nodes have been added to both ends of the doubly linked list. Head and tail are doubly nodes also called as sentinels do not store any data elements. So this is called as a header node header sentinel has a null previous reference link. And this particular part of the list is called as a trailer or tail trailer sentinel has a null next reference link. The set now go to the next slide doubly linked list structure and pointers doubly linked list object would need to store the following. It will store reference to the sentinel head node, that is, address of the head node will store the address of the list first node reference to the sentinel tail nodes, then size counter that keeps track of the number of nodes in the list, extremely two sentinels. Now empty doubly linked list empty doubly linked list, let us see what is empty. It means that there will not be any nodes in no data part will be there using sentinels. We have to we have no null links. Instead we have head dot next is equal to tell this one and tell us tell dot previous is equal to head. Now this diagram shows that the links are provided from header to teller and trailer to header. There is no node between these two header and trailer. It means that this list is empty list now singly a single node in a doubly linked list the size is equal to one. Header shows that header is there in a list and trailer is also there in between we have one node is there in one node the first the middle part will be storing the data part or element is stored and this will addressing or it will store the address of the header and this will be storing the address of the trailer. So the single linked list the single node is the first node and also the last node first node is called head dot next and last node is called as a tell dot previous reflection spot the question based on the this particular topic the header pointer points to the dash node in the doubly linked list. Take a pause over here answer the question the answer is the header pointer points to the first node in the doubly linked list this is header part which will storing the address of the first node address of this particular node where the data 10 is stored. Now in this again the same example is there four nodes are there and this is a trailer part which will be storing the address of the last node doubly linked list node creation how to create a node for that we have to define one structure named as a node the variable name of structure is node it consists of three parts the first part is in the data part and the two parts are the pointers which will be pointing to the next node and the pointer which will be pointing to the previous node. Now the first part that is data type is integer means only integer can be stored in the data part and here the pointer is declared pointer is declared saying that node star next it means that it will be storing the address of the next node pointer to the next node in a doubly linked list this struct node star previous is pointer to the previous node in a doubly linked list. Now let us see what are the advantages of doubly linked list or the single linked list list can be traversed in two directions in forward as well as in backward it is easy to for traversal and applications like searching quick update operations such as insertion deletion at both ends head and tail and also at the middle of the list in a single linked list only in one direction we can go we cannot go in the reverse direction the these are the references I hope you understood the concept of doubly linked list thank you for watching this video.