Skip to content

feat: Implement median function (closes #1)#6

Open
maitriupadhyay03-cell wants to merge 2 commits into
bsoc-bitbyte:mainfrom
maitriupadhyay03-cell:feat/implement-median
Open

feat: Implement median function (closes #1)#6
maitriupadhyay03-cell wants to merge 2 commits into
bsoc-bitbyte:mainfrom
maitriupadhyay03-cell:feat/implement-median

Conversation

@maitriupadhyay03-cell

Copy link
Copy Markdown

Overview

  1. This PR fixes Implement median #1 (Implement median).
    1. This PR adds a median function to the primary module of the rustats crate. The function takes a slice of f64 values and returns Option<f64>None for empty input, and Some(median) otherwise. It sorts a copy of the input and picks the middle element (or averages the two middle elements for even-length inputs).

Essential Checklist

  • The PR title starts with "feat: Implement median function (closes Implement median #1)", followed by a short, clear summary of the changes.
  • - [x] Tests pass: the existing tests/median.rs integration tests cover empty input, odd/even counts, sorted/unsorted input, negatives, decimals, and duplicates.
  • - [x] Docs: the function includes rustdoc comments with an example.

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.

Implement median

1 participant