Merge Sort

Description

Bubble sort is a quadratic sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order.

As the name suggest (Bubble sort) like the Bubble which are generally lighter in weight goes up like that the element of lighter (less magnitude) goes to the start and the heavier ones (higher magnitude) goes to the end.

Its a simple algorithm to implement but quite not efficient to implement for larger data set as its worst case and average case is quadratic in nature.

Time complexity
Worst Case: O(N2)
Average Case: O(N2)
Best Case: O(N)
Space complexity O(1)
java
javascript