 Today we will see the W linked list operations that is insertion of a node in the W linked list. Today we will cover the topic inserting a node at beginning of the list in a W linked list. The learning outcome of today's session student will be able to explain the operations of inserting a node at beginning in the W linked list. Let us see the definition of W linked list. A linked list is a linear data structure in which the elements are not stored at contiguous memory locations whereas in the array the memory locations are contiguous. It is a data structure consisting of collection of nodes which together represents a sequence that is called as a linked list. Now let us see the structure of the node in a W linked list. As we know in the singly linked list we have two parts that is data part and address part for a particular node but in W linked list node is an element in a linked list. It consists of three parts instead of two parts it is now three parts. In singly there were two parts in W linked list there are three parts which are the three parts. The first part is called as a data part which contains the information may be the interior character or any data type. Second part contains the address part which is the pointer which is pointing to the next node or it is holding the address of the next node and the third part is again address part which will be pointing to the previous node of the node or it is storing the address of the previous node in the list. The figure is like this. This is a data part where you can store the integer, character, plot or any data type. This is address part it will be here it will be the pointer which will be pointing to the next node or it is storing the address of the next node. This part address previous which is which will be storing the address of previous node or which is pointing to previous node. Now one more difference we see here it is two arrows are there means traversal in W linked list is possible forward and reverse with this forward and this is reverse. Now this is a simple example of a W linked list where three nodes are shown. The first node, second node, third node and this is a pointer which is pointing to the first node of the list that is called as either head or start. Now here this hundred indicates that the address this is taken as a to understand the concept we have assumed that this address is hundred but as per computer it may be any number for the sake of understanding we have considered these values these are showing as the address of the memory location. So at memory location hundred this node is stored where data part is ten integer data two hundred is the address of the next node that is stored over here. So that address is hold by this particular next pointer and this second point second node second node consists of stored at location two hundred where addresses say again the value say ten and here the address part of the previous node means previous node is stored at hundred that hundred is stored over here so the starting address of this particular node is stored by previous pointer and this is the address hold by the next node that is starting address of this particular that is three hundred is stored at the next pointer of this particular node and in a first node since there is a no previous node so this particular part previous next pointer is made as a null and if this is the last node then the last no in the last node the next pointer will also indicate to null because there is no any other further node this is a the structure or example of a doubly linked list now the types of insertion of a node in a doubly linked list there are three types insertion can be made at the beginning of the list insertion can be made at the end of the list and insertion of a element or a node can be made at the specific location in the doubly linked list now let us see today the insertion of a node or element at the beginning of the list we will see the algorithm and how to write the code in the next lights now this is the algorithm for inserting insertion of a node at the beginning of the doubly linked list the first step first of all we need to create a new node and read the data from the user that is to be inserted in the node may be integer now we integer data type and assign null to the new node next new node previous because it will be the first node so the previous link or previous pointer will be shown as a null so this can be shown new node next previous is equal to null the second step check whether list is empty or not this can be checked if head is equal to null then we can say that there are no no nodes are present in a list if it is not equal to null means head is having some address means there are nodes are present if it is so if it is empty then what we have to do we have to assign node new node next whatever the memory new node is created okay so the next pointer should be assigned as a null and new node and assign assign head to the new node or the address of the new node should be stored at pointer head so that now head will point to the first node if node is not empty means there are nodes are present in the list then what to do then new node next should be assigned to head new node should be assigned to head rather in the in the fourth step if it is not empty then assign head to new node next and new node to head now the implementation of the insertion of a node at the beginning in a doubly linked list now first of all first step is that create a node new node now for that this node is created where assuming that it is stored our memory allocation is done at location 100 and that node is hold by the pointer called as a new node so for that we need to declare a structure a node type then the two three parts one is integer data is a data type of integer type then the pointer next and previous two pointers are declared to the structure of the type structure node then as a variable to the structure new node is declared and head is also declared and head is assigned to a null initially this is a function now here in this code in this particular ppt we are going to discuss the code for the inserting a node at the beginning so with a malloc structure with a malloc okay of typecasting struct node size of this structure those many bytes will be allocated and the starting address of that will be allocated to the pointer new node second step is that treat the data to be inserted in the node and assign null to the new node previous so this can be done by print a print scan app we can read the data and new node previous this part is made null since it is the first one and if suppose it is head is equal to initially head is null so we will call this particular part new node next this is made as null and then new node the address of this new node hundred will be allocated to head so this is a second step of the algorithm and this is a code required and in the next part if it is not empty then assign head to new node next and new node to head that is it is if it is empty then this is for if it is not empty if it is not empty means already this node is there so this particular part is created with a new node then new node next this this particular part is should be stored address of this particular node now right now that is hold by this head so that that so with this statement new node next is equal to head so initially head was here in the head was here this address time was there so this hundred is stored over here then the next next is what this head should be assigned to the first node of the list so this is how we have done it now take a pause over here how many bytes are required to store one node of a doubly linked list we require 12 bytes because we require 4 bytes for integer 4 bytes for 2 each pointer so 12 bytes are required this is the entire code of a doubly linked list I hope these are the references I hope you understood how to insert a linked list thank you