Algorithm - Provide bunch of famous Algorithms for Sorting and Searching.
use Algorithm; my @list=(1, "hello", 123, "abc"); BubbleSort(\@list); print "@list\n"; #will print the sorted list. or use Algorithm; my @list=(1, "hello", 123, "abc"); my $key="abc"; #it will return index of the key if found, else -1 my $index=SequentialSearch(\@list, $key); #it will return index of the if found, else -1. @list must be sorted. my $return=BinarySearch(\@list, $key);
In this module, there are many very general sorting Algorithms written for Perl. Those are
Bubble Sort Shaker Sort Selection Sort Insertion Sort Shell Sort Quick Sort
And, there are two very general searching Algorithms(Sequential Search & Binary Search) written for Perl.
Algorithm::Sorting and Algorithm::Searching
Vipin Singh, <qwer@cpan.org>
Copyright (C) 2013 by Vipin Singh
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.3 or, at your option, any later version of Perl 5 you may have available.
To install Algorithm, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm
CPAN shell
perl -MCPAN -e shell install Algorithm
For more information on module installation, please visit the detailed CPAN module installation guide.