Welcome to the Permutation API! The Permutation API is a comprehensive tool that enables users to generate permutations of a set of items efficiently. It provides a reliable and high-performance solution for permutation calculations, making it ideal for a wide range of applications such as combinatorial optimization, data analysis, and algorithm design.
The Permutation API offers the following key features:
Total Number of Permutations Possible: this feature calculates the precise count of all the potential permutations based on the provided values of'n'and'r'.Exact Permutations: this feature allows users to find the precise permutations for any given range of'n'and'r'. This feature utilizes a specially designed algorithm that ensures accurate and efficient permutation generation.
Note : 'n' is total number of items present and 'r' is the total number of items to be selected from 'r'.
To get started with the Permutation API, follow these steps:
-
Review the API Documentation to understand the available endpoints, request parameters, and response formats.
-
Make API requests to calculate the total number of permutations possible and to find the exact permutations by providing the
'n','r', and the exact values for each item. -
Permutation API has 2 endpoints that are
findandsave. The urls for both the endpoints are:- find :
https://100050.pythonanywhere.com/permutation/V2/find/<your-api-key>/ - save :
https://100050.pythonanywhere.com/permutation/V2/save/<your-api-key>/
- find :
-
Both the endpoints are neccessary for generating the desired permutations. The
findendpoint is used to find permutation for the available variables, thesaveendpoint is used to select permutations for the next step. -
Analyze the returned results, including the number of permutations and the final permutation.
- Note : Both the endpoints should always be used for generating the permutations .
Here is an example to demonstrate use the Permutation API, for the example we will be using n as 5 and r as 3:
-
Inserting the first variable- use thefindendpoint for inserting the first variable to the permutations function with the following request data.Request{ "inserted_id": "", "nextVariable":"A", "n":5, "r":3 }Response{ "n": 5, "r": 3, "numberOfPermutations": 60, "permutationsVariables": [ "A" ], "success": true, "inserted_id": "64afb77be6f563a2b08ab7d4" } -
Saving the first variable- use thesaveendpoint for saving the first variable to the permutations function with the following request data.Request{ "inserted_id":"64afb77be6f563a2b08ab7d4", "selectedPermutation": [ "A" ] }Response{ "message": "Selected permutation ['A'] is saved successfully.", "success": true } -
Inserting the second variable- this step is similar to the first step where we inserted the first variable, the only difference would be in the request data. This time we have theinserted_idso we will send it's value with the request data.Request{ "inserted_id": "64afb77be6f563a2b08ab7d4", "nextVariable":"B", "n":5, "r":3 }Response{ "n": 5, "r": 3, "numberOfPermutations": 60, "permutationsVariables": [ [ "B", "A" ], [ "A", "B" ] ], "inserted_id": "64afb77be6f563a2b08ab7d4", "success": true } -
Selecting and saving the permutation- now we need to select one permuation from thepermutationsVariablesand save it for the next steps using thesaveendpoint.Request{ "inserted_id":"64afb77be6f563a2b08ab7d4", "selectedPermutation": [ "B", "A" ] }Response{ "message": "Selected permutation ['B', 'A'] is saved successfully.", "success": true } -
We can repeat the step
3and4for inserting the third variable and saving the selected permutation. After that we can finalize our permutation for getting the final results using thefindendpoint with the following request data.Request{ "inserted_id": "64afb77be6f563a2b08ab7d4", "nextVariable":"", "n":5, "r":3 }Response{ "message": "3 items are already selected, here is your final permutation ['B', 'C', 'A']", "n": 5, "r": 3, "numberOfPermutations": 60, "finalPermutation": [ "B", "C", "A" ], "inserted_id": "64afb77be6f563a2b08ab7d4", "success": true }
For detailed API documentation, including endpoint descriptions, request and response examples, and authentication details, please refer to the API Documentation.
If you encounter any issues, have questions, or need assistance with the Permutation API, please contact our support team.