Identify the algorithm used in the following code.
void algo(int arr[], int n){
for (int i = 0; i < n-1; i++) {
for (int j = 0; j < n-i-1; j++){
if (arr[j] > arr[j+1]) {
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
}
a. Bubble sort, O(n^2)
b. Insertion sort, O(n^2)
c. Merge sort, O(n log n)
d. Quick sort, O(n log n)
a. Bubble sort, O(n^2)
You might also like to view...
Standards encapsulate and then communicate a logical concept and resulting approach to a particular aspect of real world work.
Answer the following statement true (T) or false (F)
Should the expected + loss of a 20-meter UTP cable be greater than or less than that of a 90-meter UTP cable?
What will be an ideal response?
Which sampling technique is usually the most important to the systems analyst?
A) random sampling B) systematic sampling C) stratified sampling D) cluster sampling
You create a named range by using the ________
Fill in the blank(s) with correct word