Monday, July 27, 2009

Batchers Bitonic sort

The example i am showing will only works for 2^n numbers.

First,we need to break up the given sequence into smaller parts,we call them individual sorting parts( initially two numbers in a part, for every step it will doubles). Now sort first part in increasing and the second in decreasing order and continue like this to the end.

Second, after sorting, if the sorted part having more than two number, then you need to sort numbers with-in, and ascending or descending order depends on which part it is.

example for 8 numbers:



example for 4 numbers:

No comments: