Algorithm-Networksort
view release on metacpan or search on metacpan
lib/Algorithm/Networksort.pm view on Meta::CPAN
#
sub semijoin
{
my($jstr, $itemcount, @oldlist) = @_;
my(@newlist);
return @oldlist if ($itemcount <= 1 and $itemcount >= -1);
if ($itemcount > 0)
{
push @newlist, join $jstr, splice(@oldlist, 0, $itemcount)
while @oldlist;
}
else
{
$itemcount = -$itemcount;
unshift @newlist, join $jstr, splice(@oldlist, -$itemcount, $itemcount)
while $itemcount <= @oldlist;
unshift @newlist, join $jstr, splice( @oldlist, 0, $itemcount)
if @oldlist;
}
return @newlist;
}
1;
__END__
=head1 ACKNOWLEDGMENTS
L<Doug Hoyte|https://github.com/hoytech> provided the code for the bitonic,
odd-even merge, odd-even transposition, balanced, and bubble sort algorithms,
and the idea for what became the L<statistics()> method.
L<Morwenn|https://github.com/Morwenn> found documentation errors and networks
that went into L<Algorithm::Networksort::Best>.
=head1 SEE ALSO
=head2 Bose and Nelson's algorithm.
=over 3
=item
Bose and Nelson, "A Sorting Problem", Journal of the ACM, Vol. 9, 1962, pp. 282-296.
=item
Joseph Celko, "Bose-Nelson Sort", Doctor Dobb's Journal, September 1985.
=item
Frederick Hegeman, "Sorting Networks", The C/C++ User's Journal, February 1993.
=item
Joe Celko, I<Joe Celko's SQL For Smarties> (third edition). Implementing
Bose-Nelson sorting network in SQL.
This material isn't in either the second or fourth edition of the book.
=item
Joe Celko, I<Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL>.
The sorting network material removed from the third edition of
I<SQL For Smarties> seems to have been moved to this book.
=back
=head2 Hibbard's algorithm.
=over 3
=item
T. N. Hibbard, "A Simple Sorting Algorithm", Journal of the ACM Vol. 10, 1963, pp. 142-50.
=back
=head2 Batcher's Merge Exchange algorithm.
=over 3
=item
Code for Kenneth Batcher's Merge Exchange algorithm was derived from Knuth's
The Art of Computer Programming, Vol. 3, section 5.2.2.
=back
=head2 Batcher's Bitonic algorithm
=over 3
=item
Kenneth Batcher, "Sorting Networks and their Applications", Proc. of the
AFIPS Spring Joint Computing Conf., Vol. 32, 1968, pp. 307-3114. A PDF of
this article may be found at L<http://www.cs.kent.edu/~batcher/sort.pdf>.
The paper discusses both the Odd-Even Merge algorithm and the Bitonic algorithm.
=item
Dr. Hans Werner Lang has written a detailed discussion of the bitonic
sort algorithm here:
L<http://www.iti.fh-flensburg.de/lang/algorithmen/sortieren/bitonic/bitonicen.htm>
=item
T. H. Cormen, E. E. Leiserson, R. L. Rivest, Introduction to Algorithms,
first edition, McGraw-Hill, 1990, section 28.3.
=item
T. H. Cormen, E. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms,
2nd edition, McGraw-Hill, 2001, section 27.3.
=back
=head2 Algorithm discussion
=over 3
=item
Donald E. Knuth, B<The Art of Computer Programming, Vol. 3:
Sorting and Searching> (2nd ed.), Addison Wesley Longman Publishing Co., Inc.,
Redwood City, CA, 1998.
=item
Sherenaz W. Al-Haj Baddar and Kenneth E. Batcher,
B<Designing Sorting Networks: A New Paradigm>, Springer-Verlag, 2011
=item
Kenneth Batcher's web site (L<http://www.cs.kent.edu/~batcher/>) lists
his publications, including his paper listed above.
=back
=head1 AUTHOR
John M. Gamble may be found at B<jgamble@cpan.org>
=cut
( run in 1.742 second using v1.01-cache-2.11-cpan-39bf76dae61 )