Working –
Step 1 – Starting with the first element(index = 0), compare the current element with the next element of the array. Step 2 – If the current element is greater than the next element of the array, swap them. Step 3 – If the current element is less than the next element, move to the next element. Step 4 – Repeat Step 1 till the list is sorted.
Working – Step 1 – Starting with the first element(index = 0), compare the current element with the next element of the array. Step 2 – If the current element is greater than the next element of the array, swap them. Step 3 – If the current element is less than the next element, move to the next element. Step 4 – Repeat Step 1 till the list is sorted.
Time Complexity:- O(n2)