maTH
  • šŸ‘‹Welcome!
  • šŸ—æInstallation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🄶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🄵Data structures
      • Stack
      • Queue
      • LinkedList
    • šŸ¤“Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  1. Reference
  2. Mathematical operations

permutations

PreviouspowNextcombinations

Last updated 11 months ago

Calculate the number of arrangements of items in a specific order

int permutations(int n, int k);

will return the total number of possible arrangements of items in a specific order. There is no custom return type, the function always returns an integer.

permutations(4, 2); //12
permutations(5, 3); //60
permutations(6, 4); //360

This is the definition for "permutations with a subset": P(n,k)=n!(nāˆ’k)!P(n, k) = \frac{n!}{(n-k)!}P(n,k)=(nāˆ’k)!n!​. For "permutations", use the n!n!n! formula.

😱