incidentallysome people take the view thatbecause you can go either way equally easily on doubly linked listthere is no preferred direction and therefore terms like previous and next are inappropriate if you preferyou can substitute directionneutral terms such as left and right insertion we've included several insertion routines in the doublylinkedlist class the insertfirst(method inserts at the beginning of the listinsertlast(inserts at the endand insertafter(inserts following an element with specified key unless the list is emptythe insertfirst(routine changes the previous field in the old first link to point to the new link and changes the next field in the new link to point to the old first link finallyit sets first to point to the new link this process is shown in figure old first link first next next next next prev prev prev prev null last next prev null new link figure insertion at the beginning if the list is emptythe last field must be changed instead of the first previous field here' the codeifisempty(last newlinkelse first previous newlinknewlink next firstfirst newlink/if empty list/newlink <-last /newlink <-old first /newlink --old first /first --newlink