Algorithm::Partition - Partition a set of integers.
Version 0.04
use Algorithm::Partition qw(partition); my ($one, $two) = partition(2, 4, 1, 5, 8, 16); unless (defined($one)) { print "Error: $two"; # now $two is an error } else { print "Set 1: @$one\n"; print "Set 2: @$two\n"; }
This module does not export anything by default. You can export function partition:
use Algorith::Partition qw(partition);
This module implements an algorithm to see whether a set of integers can be split into two sets such that the sums of integers in one set is equal to the sum of integers in the other set.
Given a list of integers, this function will return two values. If the first value is undef, then no solution was found and the second value is a string explaining why. Otherwise, two array references are returned which point to the two resulting sets.
undef
The algorithm is meant for relatively small sets of integers with relatively small values. Beware.
Dmitri Tikhonov, <dtikhonov at yahoo.com>
<dtikhonov at yahoo.com>
Please report any bugs or feature requests to bug-algorithm-partition at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-Partition. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-algorithm-partition at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Algorithm::Partition
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Algorithm-Partition
CPAN Ratings
http://cpanratings.perl.org/d/Algorithm-Partition
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Algorithm-Partition
Search CPAN
http://search.cpan.org/dist/Algorithm-Partition
NJIT, Professor Joseph Leung, and the NP-Completeness course.
Copyright 2007 Dmitri Tikhonov, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Algorithm::Partition, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::Partition
CPAN shell
perl -MCPAN -e shell install Algorithm::Partition
For more information on module installation, please visit the detailed CPAN module installation guide.