Socket
Socket
Sign inDemoInstall

permutation-parity

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    permutation-parity

Computes the parity of a permutation


Version published
Weekly downloads
84K
increased by20.43%
Maintainers
1
Install size
40.6 kB
Created
Weekly downloads
 

Readme

Source

permutation-parity

Computes the parity of a permutation.

Example

var sgn = require("permutation-parity")

console.log(sgn([0, 1, 2]), sgn([0, 2, 1]))

Install

npm install permutation-parity

API

require("permutation-parity")(p)

Determines the sign of a permutation

  • p is a permutation

Returns The sign of the permutation:

  • 1 if p is odd
  • -1 if p is even
  • 0 if p is not a permutation

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Last updated on 30 Apr 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc