What sorting algorithm is implemented by the following function?

public class another {
static void sort(int[] arr) {
int n = arr.length;
int temp = 0;
for(int i=0; i < n; i++){
for(int j=1; j < (n-i); j++){
if(arr[j-1] > arr[j]){
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
}
}
a. Bubble sort.
b. Quick sort.
c. Selection sort.
d. Merge sort.


a. Bubble sort.

Computer Science & Information Technology

You might also like to view...

In C++, a variable that has been defined but not initialized may not be use as an ______. (l-value or r-value).

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Office 365 comes with a site collection built into the interface

Indicate whether the statement is true or false

Computer Science & Information Technology

The range of cells receiving the content of copied cells is called the ____.

a.destination area b.final cell c.receiving range d.receiver cell

Computer Science & Information Technology

Which of the following is not true about 5G wireless technology?

A. It will use more energy than current standards. B. It will transmit data up to 1Gbps. C. It should allow online games to be played in real time. D. It will allow the connection of more devices to the network than 4G.

Computer Science & Information Technology