Consider an array-based implementation of the sorted list. Let the array list be the data field that represents the list’s entries. If a constructor is given an array of unsorted list entries, the constructor must place them into list in sorted order. To do so, it could repeatedly use the sorted list’s add method to add the entries to the sorted list (and hence to the array list) in their proper order. Or it could copy the entries to list and sort them by using a sort algorithm from Chapters 15 and 16
a. If you use the first approach, what sort are you actually using?
b. Would you ever want to use the second approach? Explain.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here