The proposed algorithm (Oyelami’s sort)
This proposed sorting algorithm divides the elements to be sorted
into subsequences just like Shellsort does but by first of all
comparing the first element with the last. If the last is less than the
first, the two swap positions, otherwise, they maintain their
positions. Later, the second element is compared with the second
to the last, if the second to the last element is smaller than the
second, they are swapped. Otherwise, they maintain their positions.
This process continues until the last two consecutive middle
elements are compared or until it remains only one element in the
middle. After this, Bidirectional Bubble Sort is applied to sort the
adjacent elements. This approach reduces the number of
comparisons and inversions carried out significantly.
Consider the worst-case scenario of sorting the following
elements used for Batcher’s Sort and Bitonic Sort in ascending
order:
8 4 3 2
The algorithm works like this:
8 4 3 2
2 4 3 8
2 3 4 8 (*)