2017 © Pedro Peláez
 

library permutations

Generates (lexographical) permutations of numbers.

image

jelle-s/permutations

Generates (lexographical) permutations of numbers.

  • Wednesday, January 11, 2017
  • by Jelle-S
  • Repository
  • 1 Watchers
  • 0 Stars
  • 197 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Generates (lexographical) permutations., (*1)

Build Status Code Climate Test Coverage Issue Count, (*2)

use Jelle_S\Util\Permutation\LexographicalPermutation;
$number = 12345;
$next = LexographicalPermutation::getNextPermutation($number);
print "The next lexographical permutation of {$number} is {$next}.\n";

$number = 32154;
$previous = LexographicalPermutation::getPreviousPermutation($number);
print "The previous lexographical permutation of {$number} is {$previous}.\n";

$first = LexographicalPermutation::getFirstPermutation($number);
print "The first lexographical permutation of {$number} is {$first}.\n";

$last = LexographicalPermutation::getLastPermutation($number);
print "The last lexographical permutation of {$number} is {$last}.\n";

$number = 3124;
$all = print_r(LexographicalPermutation::getAllPermutations($number), TRUE);
print "All lexographical permutations of {$number} are \n{$all}\n";

Output:, (*3)

The next lexographical permutation of 12345 is 12354.
The previous lexographical permutation of 32154 is 32145.
The first lexographical permutation of 32154 is 12345.
The last lexographical permutation of 32154 is 54321.
All lexographical permutations of 3124 are 
Array
(
    [0] => 1234
    [1] => 1243
    [2] => 1324
    [3] => 1342
    [4] => 1423
    [5] => 1432
    [6] => 2134
    [7] => 2143
    [8] => 2314
    [9] => 2341
    [10] => 2413
    [11] => 2431
    [12] => 3124
    [13] => 3142
    [14] => 3214
    [15] => 3241
    [16] => 3412
    [17] => 3421
    [18] => 4123
    [19] => 4132
    [20] => 4213
    [21] => 4231
    [22] => 4312
    [23] => 4321
)

The Versions

11/01 2017

dev-develop

dev-develop

Generates (lexographical) permutations of numbers.

  Sources   Download

GPL-3.0+

The Development Requires

by Jelle Sebreghts

27/12 2016

dev-master

9999999-dev

Generates (lexographical) permutations of numbers.

  Sources   Download

GPL-3.0+

The Development Requires

by Jelle Sebreghts

26/12 2016

1.0.1

1.0.1.0

Generates (lexographical) permutations of numbers.

  Sources   Download

GPL-3.0+

by Jelle Sebreghts

13/12 2016

1.0.0

1.0.0.0

Generates (lexographical) permutations of numbers.

  Sources   Download

GPL-3.0+

by Jelle Sebreghts