diff --git a/codes/TechOS/18361562.java b/codes/TechOS/18361562.java new file mode 100644 index 0000000000000000000000000000000000000000..a4cc45a954a653cb54dc996bb7bfc4833a3ddc48 --- /dev/null +++ b/codes/TechOS/18361562.java @@ -0,0 +1,14 @@ +public class BubbleSort { + public static void bubbleSort(int[] arr) { + int n = arr.length; + for (int i = 0; i < n - 1; i++) { + for (int j = 0; j < n - i - 1; j++) { + if (arr[j] > arr[j + 1]) { + int temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + } + } + } + } +}