Skip to main content

Practice · 3 of 3

Median Without Mutation

CHALLENGE
Difficulty: beginner+25 XP

Implement double median(const int *a, int n) returning the median WITHOUT modifying a: odd n -> middle of the sorted values; even n -> mean of the two middle values. Copy to a local buffer and sort it.

Back to lesson: Practice: Sort Practice