listing continued /end class link ///////////////////////////////////////////////////////////////class sortedlist private link first/ref to first item on list /public sortedlist(/constructor (no argsfirst null/initialize list /public sortedlist(link[linkarr/constructor (array /as argumentfirst null/initialize list for(int = <linkarr lengthj++/copy array insertlinkarr[ )/to list /public void insert(link /insert (in orderlink previous null/start at first link current first/until end of listwhile(current !null & ddata current ddata/or key currentprevious currentcurrent current next/go to next item if(previous==null/at beginning of list first /first -- else /not at beginning previous next /old prev -- next current/ --old current /end insert(/public link remove(/return delete first link /(assumes non-empty listlink temp first/save first first first next/delete first return temp/return value //end class sortedlist