Complete the following code for sorting an array of objects of the described ??????? class. The method should sort the elements of the array of students such that names are arranged based on lexicographic ordering. public void sort(student[] aArray) { student temp; int chosenIndex = 0; for (int x = 0; x < aArray.length - 1; x++) { chosenIndex = x; for (int y = x + 1; y
Complete the following code for sorting an array of objects of the described ??????? class. The method should sort the elements of the array of students such that names are arranged based on lexicographic ordering.
public void sort(student[] aArray) {
student temp;
int chosenIndex = 0;
for (int x = 0; x < aArray.length - 1; x++) {
chosenIndex = x;
for (int y = x + 1; y <aArray.length; y++) {
if (_____)
chosenIndex = y;
}
if (chosenIndex != x) {
temp = _____;
aArray[x] = ______;
_______;
}
}
}
Step by step
Solved in 2 steps