Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 1 5 1 2 1
- 11 5 1 2 1
- 1 15 1 2 1
- 1 1 51 2 1
- 1 1 5 12 1
- 1 1 5 1 21
- function pc_permute($items, $perms = array( )) {
- if (empty($items)) {
- print join(' ', $perms) . "n";
- } else {
- for ($i = count($items) - 1; $i >= 0; --$i) {
- $newitems = $items;
- $newperms = $perms;
- list($foo) = array_splice($newitems, $i, 1);
- array_unshift($newperms, $foo);
- pc_permute($newitems, $newperms);
- }
- }
- }
- print_r(pc_permute($ns));
Add Comment
Please, Sign In to add comment