Skip to content

feat: add percentile algorithm - #2019

Open
sarthakgupta1907-cell wants to merge 1 commit into
TheAlgorithms:masterfrom
sarthakgupta1907-cell:feat/maths-percentile
Open

sarthakgupta1907-cell wants to merge 1 commit into
TheAlgorithms:masterfrom
sarthakgupta1907-cell:feat/maths-percentile

Conversation

@sarthakgupta1907-cell

Copy link
Copy Markdown

Describe your change:

Add implementation of the percentile algorithm in Maths/Percentile.js.

Calculates the nth percentile of an array using linear interpolation.

  • Example: percentile([1, 2, 3, 4, 5], 50) => 3
  • Example: percentile([1, 2, 3, 4, 5], 75) => 4

Checklist:

  • I have read CONTRIBUTING. md.
  • This pull request is all my own work—I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames are in the format MyAlgorithmName.js -- PascalCase.
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • All new algorithms have tests, and the tests pass.
  • All code is formatted with npx standard --fix .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant