We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ed855d6 + 16f2fc1 commit f2d1157Copy full SHA for f2d1157
src/com/jwetherell/algorithms/sorts/BubbleSort.java
@@ -21,7 +21,8 @@
21
public class BubbleSort<T extends Comparable<T>> {
22
23
private BubbleSort() { }
24
-
+ //@param unsorted array
25
+ //@return sorted array
26
public static <T extends Comparable<T>> T[] sort(T[] unsorted) {
27
boolean swapped = true;
28
int length = unsorted.length;
@@ -37,7 +38,7 @@ public static <T extends Comparable<T>> T[] sort(T[] unsorted) {
37
38
}
39
return unsorted;
40
41
+ //swapping the value
42
private static <T extends Comparable<T>> void swap(int index1, int index2, T[] unsorted) {
43
T value = unsorted[index1];
44
unsorted[index1] = unsorted[index2];
0 commit comments