The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Algorithm::Bitonic::Sort - Sorting numbers with Bitonic Sort

VERSION

Version 0.03

SYNOPSIS

Use Algorithm::Bitonic::Sort with the following style.

        use Algorithm::Bitonic::Sort;
        
        my @sample = (1,4,8,4,4365,67,33,345);
        my @result_up   = bitonic_sort( 1 ,@sample);    # incremental
        my @result_down = bitonic_sort( 0 ,@sample);    # decremental

DESCRIPTION

This is an Perl 5 implementation of Ken Batcher's Bitonic mergesort.

Limitation

The original Bitonic can only sort N numbers, which N is a power of 2.

Which means that you can sort a set of numbers (an array or list) which contains 2 (2**1) or 4 (2**2) or 8 (2**3) or any 2**M amount of members.

EXPORT

bitonic_sort

SUBROUTINES

bitonic_sort

Accepts the first param as the ascending/decreasing selector. True (1 or any true value) means ascending (incremental), False (0 or any false value) means decreasing.

All the rest params will treat as members/items to be sorted.

WARNING: Giving any amount of members not equal to 2**N will have unexpected result and fail.

AUTHOR

BlueT - Matthew Lien - 練喆明, <BlueT at BlueT.org>

BUGS

Please report any bugs or feature requests to bug-algorithm-bitonic-sort at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-Bitonic-Sort. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Algorithm::Bitonic::Sort

You can also look for information at:

ACKNOWLEDGEMENTS

SEE ALSO

LICENSE AND COPYRIGHT

Copyright 2012 BlueT - Matthew Lien - 練喆明.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.