Skip to main content

Practice ยท 3 of 3

Median Without Mutation

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.

Difficulty: beginner

Back to lesson: Practice: Sort Practice