mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-15 21:51:05 +00:00
[PR #1550] feat: add quick select algorithm using median of medians #2159
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/TheAlgorithms/C/pull/1550
State: open
Merged: No
Description of Change
This Pull Request adds the Quick Select algorithm using the median of medians approach. Unlike the standard Quick Select algorithm which has a worst-case time complexity of O(n^2) depending on pivot selection, this implementation uses the median of medians technique to guarantee a "good" pivot. This ensures a worst-case time complexity of O(n), making it highly efficient for finding the kth largest element in an array.
References
Checklist
Notes: Implemented a linear-time selection algorithm using median-of-medians for optimal pivot selection and O(n) worst-case performance.