the output will be different each time because the initial values are generated randomly new constructor for sortedlist takes an array of link objects as an argument and inserts the entire contents of this array into the newly created list by doing soit helps make things easier for the client (the main(routinewe've also made change to the insert(routine in this program it now accepts link object as an argumentrather than long we do this so we can store link objects in the array and insert them directly into the list in the sortedlist java program (listing )it was more convenient to have the insert(routine create each link objectusing the long value passed as an argument the downside of the list insertion sortcompared with an array-based insertion sortis that it takes somewhat more than twice as much memorythe array and linked list must be in memory at the same time howeverif you have sorted linked list class handythe list insertion sort is convenient way to sort arrays that aren' too large doubly linked lists let' examine another variation on the linked listthe doubly linked list (not to be confused with the double-ended listwhat' the advantage of doubly linked lista potential problem with ordinary linked lists is that it' difficult to traverse backward along the list statement like current=current next steps conveniently to the next linkbut there' no corresponding way to go to the previous link depending on the applicationthis limitation could pose problems for exampleimagine text editor in which linked list is used to store the text each text line on the screen is stored as string object embedded in link when the editor' user moves the cursor downward on the screenthe program steps to the next link to manipulate or display the new line but what happens if the user moves the cursor upwardin an ordinary linked listyou would need to return current (or its equivalentto the start of the list and then step all the way down again to the new current link this isn' very efficient you want to make single step upward the doubly linked list provides this capability it allows you to traverse backward as well as forward through the list the secret is that each link has two references to other links instead of one the first is to the next linkas in ordinary lists the second is to the previous link this type of list is shown in figure