Solved

Consider the Following Code Snippet

Question 76

Multiple Choice

Consider the following code snippet:
Public static void sort(int[] a) {
For (int i = 1; i < a.length; i++)
{
int next = a[i];
int j = i;
while (j > 0 && a[j - 1] > next)
{
a[j] = a[j - 1];
j--;
}
a[j] = next;
}
}
What sort algorithm is used in this code?


A) insertion sort
B) selection sort
C) merge sort
D) quicksort

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions