Comparisons are blue,
swaps are red.
Odd-Even Sort / Brick Sort - This is 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.
Like bubble sort, odd-even sort works by iterating through the list, comparing adjacent elements, and swapping them if they're in the wrong order. The unique characteristic of the odd-even sort, and also how it got its name, is how the sort's iterations alternate between sorting odd/even and even/odd indexed pairs.
What if you were faced with the frustrating task of sorting a list? You might be tempted to try your hand at bubble sort, but there's also an innovative algorithm called Odd-Even Sort. This algorithm is based on two different phase: odd and even phase. The work begins by comparing adjacent elements in each iteration until all items are sorted; then when one side reaches its end (odd or even), it switches over to alternate for the rest of the iterations while staying on that same respective side which ends up placing both sides together as we reach completion!
An element in a group is sorted by placing it in ascending order, descending order, alphabetical order, etc. It is very common to sort a list of elements. An algorithm that uses sequential sorting is not efficient when sorting large volumes of data. Sorting, therefore, is performed in parallel. A parallel algorithm is one that can be executed on multiple devices at the same time, and it then applies the outputs from each device simultaneously to produce its output. This algorithm is based on a bubble sort technique, which is a parallel algorithm. Brick Sort is another name for it.
An Odd-Even Sort or brick sort is a simple sorting algorithm that was first developed on parallel processors with local interconnection. It works by comparing all of the odd/even pairs, and if they are not in order, it will switch them so that everything should end up sorted at the end!