Skip to main content

A Python utility to generate all permutations of a list of elements using Heap's algorithm.

Project description

Permutations Generator

A Python utility to generate all permutations of a list of elements using Heap's algorithm.

Overview

This script generates all possible permutations of a given list of elements. It uses Heap's algorithm, an efficient recursive approach that generates permutations by swapping elements in a systematic manner.

Usage

Run the script from the command line with a list of elements to permute:

python permutations.py element1 element2 element3 ...

Example

python permutations.py 1 2 3

Output:

['1', '2', '3']
---------------------------------------
1 2 3 
1 3 2 
2 1 3 
2 3 1 
3 1 2 
3 2 1 

Requirements

  • Python 3.6 or higher

Notes

  • Elements are treated as strings when passed via command line
  • The total number of permutations for n elements is n! (factorial)
  • For large input lists (n > 10), execution time and memory usage will increase significantly

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

permutations_younes-0.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

permutations_younes-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file permutations_younes-0.0.1.tar.gz.

File metadata

  • Download URL: permutations_younes-0.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for permutations_younes-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ccc1d806f71de5433e55700d7d0973e1f2b8b758ea8a17c4af6b98404282e476
MD5 09dd40408496a5ca0dd43e1113fde757
BLAKE2b-256 680c485a8f9452dc765d6ab6c6a9da2a547ee08f50f7039ae8fde63f9c8d256c

See more details on using hashes here.

File details

Details for the file permutations_younes-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for permutations_younes-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f58a5b511b6ecc980bbe86499d3d184cb12741c1f148431f1aec0bf4bccbdff9
MD5 b7b5b48e13a3a4d5f65256a7ec2226fb
BLAKE2b-256 7ebb694b3a94e38a93fc674328c8849118c78212b6e13cfa843e4e9bca1d1b06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page