thelist displayforward()/display list forward thelist insertafter( )thelist insertafter( )/insert after /insert after thelist displayforward()/end main(/display list forward /end class doublylinkedapp in main(we insert some items at the beginning of the list and at the enddisplay the items going both forward and backwarddelete the first and last items and the item with key display the list again (forward only)insert two items using the insertafter(methodand display the list again here' the outputlist (first-->last) list (last-->first) list (first-->last) list (first-->last) the deletion methods and the insertafter(method assume that the list isn' empty although for simplicity we don' show it in main()isempty(should be used to verify that there' something in the list before attempting such insertions and deletions doubly linked list as basis for deques doubly linked list can be used as the basis for dequementioned in the last in deque you can insert and delete at either endand the doubly linked list provides this capability iterators we've seen how it' possible for the user of list to find link with given key using find(method the method starts at the beginning of the list and examines each link until it finds one matching the search key other operations we've looked atsuch as deleting specified link or inserting before or after specified linkalso involve searching through the list to find the specified link howeverthese methods don' give the user any control over the traversal to the specified item suppose you wanted to traverse listperforming some operation on certain links for exampleimagine personnel file stored as linked list you might want to increase the wages of all employees who were being paid minimum wagewithout affecting employees already above the minimum or suppose that in list of mail-order customersyou decided to delete all customers who had not ordered anything in six months in an arraysuch operations are easy because you can use an array index to keep track of your position you can operate on one itemthen increment the index to point to the next itemand see if that item is suitable candidate for the operation howeverin linked listthe links don' have fixed index numbers how can we provide list' user with something analogous to an array indexyou could repeatedly use find(to look for appropriate items in listbut this requires many comparisons to find each link it' far more efficient to step from link to linkchecking if each one meets certain criteria and performing the appropriate operation if it does reference in the list itself