Questions tagged [permutations]

A permutation is a particular ordering of some list of objects. Problems tagged with permutation usually involve finding or generating permutations, including anagrams of text.

Filter by
Sorted by
Tagged with
3
votes
3answers
387 views

Find the next subpermutation of base-64 digits

Permutations of a set have a natural order called lexicographic order in which two permutations are compared by comparing the first position at which they differ. For the purposes of this question we'...
4
votes
4answers
2k views

Obtaining ordering of cards [closed]

You are given a deck containing n cards. While holding the deck: Take the top card off the deck and set it on the table Take the next card off the top and put it on the bottom of the deck in your ...
18
votes
14answers
1k views

The Strange Unsorting Machine for Nefarious Purposes

Good Evening Golfers! Your challenge is to completely unsort a series of numbers. Input Exactly 100 integers will be fed to your program. Your program may accept the input either as a file, or via ...
20
votes
25answers
2k views

Code-Golf: Permutations

Write a function that takes as input a set of integers (can be a list, array or any other container with distinct numbers), and outputs the list of all its permutations. Python (95 chars): ...
15
votes
6answers
2k views

Decompose a permutation into cycles

There is a well-known theorem that any permutation can be decomposed into a set of cycles. Your job is to write the shortest possible program to do so. Input: Two lines. The first contains a ...
14
votes
3answers
473 views

Permutation group operation

There is a well-known bijection between the permutations of n elements and the numbers 0 to n!-1 such that the lexicographic ordering of the permutations and the corresponding numbers is the same. For ...
85
votes
133answers
11k views

Determine whether strings are anagrams

Challenge Given two strings, work out if they both have exactly the same characters in them. Example Input word, wrdo This returns true because they are the ...