because any new node can not be added before null allocate memory for the new nodelet it be called new_node set new_node->data new_data set the previous pointer of this new_node as the previous node of the next_nodenew_node->prev next_node->prev set the previous pointer of the next_node as the new_nodenext_node->prev new_node set the next pointer of this new_node as the next_nodenew_node->next next_node if the previous node of the new_node is not nullthen set the next pointer of this previous node as new_nodenew_node->prev->next new_node