public int[] selectionSort(int[] arr, int type) {
int temp = 0;
for (int i = 0; i < arr.length - 1; i++) {
int index = i;
for (int j = i + 1; j < arr.length; j++) {
if (type == 0 && arr[j] < arr[index]) {
index = j;
} else if (type == 1 && arr[j] > arr[index]) {
index = j;
}
}
temp = arr[i];
arr[i] = arr[index];
arr[index] = temp;
}
return arr;
}
public int[] bubbleSort(int[] arr, int type) {
int temp = 0;
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (type == 0 && arr[i] > arr[j]) {
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
} else if (type == 1 && arr[i] < arr[j]) {
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}