/return delete first link /(assumes non-empty listlink temp first/save first first first next/delete first return temp/return value /public void displaylist(system out print("list (first-->last)")link current first/start at beginning of list while(current !null/until end of listcurrent displaylink()/print data current current next/move to next link system out println("")/end class sortedlist ///////////////////////////////////////////////////////////////class sortedlistapp public static void main(string[args/create new list sortedlist thesortedlist new sortedlist()thesortedlist insert( )/insert items thesortedlist insert( )thesortedlist displaylist()/display list thesortedlist insert( )thesortedlist insert( )thesortedlist insert( )/insert more items thesortedlist displaylist()/display list thesortedlist remove()/remove an item thesortedlist displaylist()/display list /end main(/end class sortedlistapp in main(we insert two items with key values and then we insert three more itemswith values and these are inserted at the beginning of the listin the middleand at the endshowing that the insert(routine correctly handles these special cases finallywe remove one item to show removal is always from the front of