listsstacksand queues prev figure insertion in doubly linked list by getting new node and then changing pointers in the order indicated steps and can be combinedyielding only two linesnode *newnode new nodexp->prevp } ->prev ->prev->next newnode/steps and /steps and but then these two lines can also be combinedyieldingp->prev ->prev->next new nodexp->prevp }this makes the insert routine in figure short figure shows the logic of removing node if points to the node being removedonly two pointers change before the node can be reclaimedp->prev->next ->nextp->next->prev ->prevdelete pfigure shows pair of erase routines the first version of erase contains the three lines of code shown above and the code to return an iterator representing the item after /insert before itr iterator insertiterator itrconst object node * itr currentthesize++return ->prev ->prev->next new nodexp->prevp }/insert before itr iterator insertiterator itrobject & node * itr currentthesize++return ->prev ->prev->next new nodestd::movex ) ->prevp }figure insert routine for list class