/for / ///////////////////////////////////////////////////////////////class link public double ddata/data item public link next/next link in list /public link(double dd/constructor ddata dd/public void displaylink(/display this link system out print(ddata ")/end class link ///////////////////////////////////////////////////////////////class sortedlist private link firstlist /ref to first item on /public sortedlist(/constructor first null/public boolean isempty(/true if no links return (first==null)/public void insert(double key/insert in order link newlink new link(key)/make new link link previous null/start at first link current first/until end of listwhile(current !null &key current ddata/or key currentprevious currentcurrent current next/go to next item if(previous==null/at beginning of list first newlink/first --newlink else /not at beginning previous next newlink/old prev --newlink newlink next current/newlink --old currnt /end insert(