mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 13:39:08 +08:00
Fixed <T> parameter error in SelectionSort
This commit is contained in:
@ -10,10 +10,12 @@ public class SelectionSort implements SortAlgorithm {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method swaps the two elements in the array
|
* This method swaps the two elements in the array
|
||||||
|
* @param <T>
|
||||||
* @param arr, i, j The array for the swap and
|
* @param arr, i, j The array for the swap and
|
||||||
the indexes of the to-swap elements
|
the indexes of the to-swap elements
|
||||||
*/
|
*/
|
||||||
public void swap(T[] arr, int i, int j) {
|
|
||||||
|
public <T> void swap(T[] arr, int i, int j) {
|
||||||
T temp = arr[i];
|
T temp = arr[i];
|
||||||
arr[i] = arr[j];
|
arr[i] = arr[j];
|
||||||
arr[j] = temp;
|
arr[j] = temp;
|
||||||
|
Reference in New Issue
Block a user