Java Program for Odd-Even Sort / Brick Sort
This is basically a variation of bubble-sort. This algorithm is divided into two phases- Odd and Even Phase. The algorithm runs until the array elements are sorted and in each iteration two phases occurs- Odd and Even Phases. In the odd phase, we perform a bubble sort on odd indexed elements and in the even phase, we perform a bubble sort on even indexed elements.
-9 2 10 34
Time Complexity : O(N2) where, N = Number of elements in the input array.
Auxiliary Space : O(1). This is an in-place algorithm, so no extra space is required.
Please refer complete article on Odd-Even Sort / Brick Sort for more details!