Merge Sort

merge sort package sorting; import java.util.Arrays; public class MergeSort { public static void main(String[] args) { int[] arr = new int[]{5,4,3,2,1,23,2,4,1}; mergeSort(arr, 0, arr.length - 1); System.out.println(Arrays.toString(arr)); } static void…

Selection Sort

selection sort package sorting; import java.util.Arrays; public class SelectionSort { public static void main(String[] args) { int[] arr = new int[]{5, 4, 3, 2, 1}; selectionSort(arr); System.out.println(Arrays.toString(arr)); } static void…