data structures using figure shows the algorithm to insert new node at the end of doubly linked list in step we take pointer variable ptr and initialize it with start in the while loopwe traverse through the linked list to reach the last node once we reach the last nodein step we change the next pointer of the last node to store the address of the new node remember that the next field of the new node contains null which signifies the end of the linked list the prev field of the new_node will be set so that it points to the node pointed by ptr (now the second last node of the liststep if avail null write overflow go to step [end of ifstep set new_node avail step set avail avail -next step set new_node -data val step set new_node -next null step set ptr start step repeat step while ptr -next !null step set ptr ptr -next [end of loopstep set ptr -next new_node step set new_node -prev ptr step exit figure algorithm to insert new node at the end step if avail null write overflow go to step [end of ifstep set new_node avail step set avail avail -next step set new_node -data val step set ptr start step repeat step while ptr -data !num step set ptr ptr -next [end of loopstep set new_node -next ptr -next step set new_node -prev ptr step set ptr -next new_node step set ptr -next -prev new_node step exit figure algorithm to insert new node after given node inserting node after given node in doubly linked list consider the doubly linked list shown in fig suppose we want to add new node with value after the node containing before discussing the changes that will be done in the linked listlet us first look at the algorithm shown in fig start allocate memory for the new node and initialize its data part to take pointer variable ptr and make it point to the first node of the list start,ptr move ptr further until the data part of ptr value after which the node has to be inserted start ptr insert the new node between ptr and the node succeeding it ptr start start figure inserting new node after given node in doubly linked list