Algorithm::SISort

Algorithm::SISort is a Perl module that contains select and insert sorting algorithm.
Download

Algorithm::SISort Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Hrafnkell F. Hlodversson
  • Publisher web site:
  • http://search.cpan.org/~hrafnkell/Algorithm-SISort-0.14/SISort.pm

Algorithm::SISort Tags


Algorithm::SISort Description

Algorithm::SISort is a Perl module that contains select and insert sorting algorithm. Algorithm::SISort is a Perl module that contains select and insert sorting algorithm.SYNOPSIS use Algorithm::SISort qw(Sort Sort_inplace); @sorted_list = Sort {$_ $_} @unsorted_list; # ... or ... $number_of_comparisons = Sort_inplace {$_ $_} @unsorted_list;This module implements a sorting algorithm I saw in BIT 28 (1988) by Istvn Beck and Stein Krogdahl. This implementation is mainly intended to try out the Inline module by Brian Ingerson. The algorithm is a combination of Straight Insertion Sort and Selection Sort. While Insertion Sort and Selection Sort both are of complexity O(n**2), Select and Insert Sort should have complexity O(n**1.5).This module defines the functions Sort and Sort_inplace, which have signatures similar to the internal sort function. The difference is that a codref defining a comparison is always required and that the two values to compare are always passed in @_ and not as $a and $b. (Although I might change that later.)Sort returns a sorted copy if the array, but Sort_inplace sorts the array in place (as the name suggests) and returns the number of comparisons done. (Note that the sorting is always done in place, Sort just copies the array before calling the internal sort routine.) Requirements: · Perl


Algorithm::SISort Related Software