Skip to content

Shouldn't mode function return multiple values? #103

Closed
@80Quattro

Description

@80Quattro

The mode is the value that appears most often in a set of data values.
Source: (Wikipedia)

But what when there are more than one most often appear value?
Example: (5, 5, 6, 6, 7) -> there are two most often appear values -> 5 and 6

The mode is not necessarily unique to a given discrete distribution, since the probability mass function may take the same maximum value at several points x1, x2, etc.
Source: (Wikipedia)

The mode function in this repository returns only one value (not even the smallest or the greatest).
Shouldn't return an array of the most appear value/values?

Examples:
mode(5, 5, 6, 6); returns: 5, expected: [5, 6]
mode(6, 5, 5, 5, 6, 6); returns: 6, expected: [5, 6]
mode(1, 1, 2, 3, 4); returns: 1, expected: [1]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions