1. Which sorting algorithm can be improved with the followingsimple optimization? During each pass, you keep track of whether aswap was made. At the end of a pass, if no swaps were made, you canassume the list is sorted.
a. Insertion sort
b. Selection sort
c. Bubble Sort
d. None of the above
2. If you want to use Java's built-in Collections.sort() methodto sort an ArrayList, what do you have to ensure about the type ofobject stored in your ArrayList?
a. That it is a primitive
b. That the object class implements Comparable
c. That all the objects in the ArrayList are of the EXACT sameclass (ie not sub-class objects)
d. That the object class contains a String or int field so thatit can be used for sorting
3. Insertion Sort and Selection Sort have what order ofworst-case complexity?
a. O(1)
b. O(n)
c. O(n2)
d. O(log n)