package Sorting; import java.util.*; public class BubbleSort { // Time Complexity of Bubble Sort = O(n^2) public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the size of array:"); int size = sc.nextInt(); int arr[] = new int[size]; //for input System.out.print("Enter the element of array: "); for(int i=0; i arr[j+1]){ //(if print the array element in ascending order ) //swap the element int temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } System.out.println("Sorted array element using Bubble Sort : "); for(int i=0; i