1.0.4 • Published 10 months ago

@algorithm.ts/permutation v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Create all permutations of the given natural number.

Install

  • npm

    npm install --save @algorithm.ts/permutation
  • yarn

    yarn add @algorithm.ts/permutation

Usage

  • Basic

    import { permutation } from '@algorithm.ts/permutation'
    
    for (const nums of permutation(7)) {
      // Tranverse the permutation of [0, 1, 2, 3 ,4, 5, 6]
    }
    
    Array.from(permutation(3, 1))
    // [
    //   [1, 2, 3],
    //   [1, 3, 2],
    //   [2, 1, 3],
    //   [2, 3, 1],
    //   [3, 1, 2],
    //   [3, 2, 1]
    // ]

Related

1.0.4

10 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago