About 1,800,000 results
Open links in new tab
  1. How do I generate all permutations of a list? - Stack Overflow

    The following code is an in-place permutation of a given list, implemented as a generator. Since it only returns references to the list, the list should not be modified outside the generator.

  2. Finding all possible permutations of a given string in python

    Nov 29, 2011 · The itertools module has a useful method called permutations (). The documentation says: itertools.permutations (iterable [, r]) Return successive r length …

  3. How to generate permutations of array in python?

    Jan 23, 2010 · To generate one permutation use random.shuffle and store a copy of the result. Repeat this operation in a loop and each time check for duplicates (there probably won't be …

  4. python - Generating all permutations efficiently - Stack Overflow

    Oct 10, 2020 · I need to generate as fast as possible all permutations of integers 0, 1, 2, ..., n - 1 and have result as a NumPy array of shape (factorial(n), n), or to iterate through large portions …

  5. python - Permutations with unique values - Stack Overflow

    The statement "any permutation of a sorted iterable are in sorted order" wasn't even true of older versions of Python. I tested Python versions back through 2.7 and found your result accurate. …

  6. How do i create a permutation on Python without using the …

    Check out permutations at rosettacode.org. Granted, for python, it uses itertools, but for low-level languages, it gives the algorithm that you could easily port to python.

  7. python - How can I get "permutations with …

    A permutation is an arrangement of objects where order matters. OP is correctly asking for a permutation of objects in n places, with the caveat that the object can be repeated. This is …

  8. python - Generate permutations of list with repeated elements

    34 In Python, it is quite simple to produce all permutations of a list using the itertools module. I have a situation where the sequence I'm using only has two characters (i.e. '1122'). I want to …

  9. python - counting combinations and permutations efficiently

    I have some code to count permutations and combinations, and I'm trying to make it work better for large numbers. I've found a better algorithm for permutations that avoids large intermediate …

  10. permutations of two lists in python - Stack Overflow

    Dec 23, 2009 · I have two lists like: list1 = ['square','circle','triangle'] list2 = ['red','green'] How can I create all permutations of these lists, like this: [ 'squarered ...