quiz2 Flashcards
Each class provides its own implementation of hashCode()
False
Which of the following sorting algorithm is NOT stable?
b.
Selection sort
Object class contains hashCode() method with its default implementation
True
The given illustration is about __________.
a.
Merge sort
A hash table uses a hash function (algorithm) to compute an index
True
Which of the following sorting algorithms has the lowest worst-case complexity?
d.
merge sort
The following code is an implementation of _________________.
c.
Top-down reheapify (sink) implementation
The next statements are about _______ sort.
Select a pivot point which could be: First element, Last element, Middle element in the sequence
Partition the other elements into two sub-arrays, according to whether they are less or greater than the pivot point
a.
Quick
What is represented in the Figure below:
c.
Hash Table
Which of the following sorting algorithms not has a worst-case time complexity of O(n^2)?
c.
Merge Sort
Which sorting algorithm works by repeatedly selecting the largest remaining element and placing it at the beginning of the sorted portion of the array?
d.
Selection Sort
Which of the following sorting algorithms can be used for sorting linked lists?
c.
Merge Sort
The following method is an implementation of ___________.
public static void XXX(int[] arr, int left, int right) {
if (left >= right) {
return;
}
int pivot = YYY(arr, left, right);
XXX(arr, left, pivot - 1);
XXX(arr, pivot + 1, right);
}
public static int YYY(int[] arr, int left, int right) {
int pivot = arr[right];
int i = left - 1;
for (int j = left; j < right; j++) {
if (arr[j] < pivot) { i++; int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }
}
int temp = arr[i + 1];
arr[i + 1] = arr[right];
arr[right] = temp;
return i + 1;
}
a.
Quick sort
Which of the following sorting algorithm has best case time complexity of O(n^2)?
c.
insertion sort
Which of the following sorting algorithms requires extra memory space to sort an array?
a.
Merge Sort