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...



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.

Nov 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here