Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance mode() Function to Return Multiple Modes #117

Merged

Conversation

salehhashemi1992
Copy link
Contributor

@salehhashemi1992 salehhashemi1992 commented Sep 16, 2023

Enhance the mode() function to return an array of all mode values instead of returning just a single mode value.

According to mathematical definitions, a dataset can have multiple modes (bimodal or multimodal distributions). This update aligns the mode() function with this mathematical truth, making it more accurate and useful.

Added unit tests to confirm that:
An array of a single mode is returned when there is one mode.
An array of multiple modes is returned when there are multiple modes.
An array of all numbers is returned when each number is unique and thus all are modes.

Copy link
Contributor

@darwinz darwinz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this improvement!

@darwinz darwinz merged commit 986d136 into TheAlgorithms:master Sep 18, 2023
1 check passed
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.

2 participants