Skip to content

statistics.median() complexity #135157

Open
Open
@ryanrudes

Description

@ryanrudes

Median can be computed in time O(n log n) without sorting using the select-k algorithm.

https://github.com/python/cpython/blob/169cdfefce83fabcea48d0ba24ca4dba210f41d0/Lib/statistics.py#L327C1-L348C43

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagestdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions