Mean vs Median Under Skew
Xem dạng PDF
Gửi bài giải
Điểm:
100,00
Giới hạn thời gian:
2.0s
Giới hạn bộ nhớ:
256M
Tác giả:
Dạng bài
Ngôn ngữ cho phép
Python
Task
Given a baseline array x of n values and a single outlier value v, compute the mean and median of x and of x' = x + [v]. Return all four values.
Input
- Line 1: integer
n - Line 2:
nspace-separated floats (baseline) - Line 3: one float — the outlier
v
Output
Four space-separated floats: mean_before mean_after median_before median_after
Example
Input:
5
40 42 41 43 41
95
Output:
41.4 57.66666667 41 41.5
Scaffolding
def mean_median_analysis(x: list[float], outlier: float) -> tuple: ...
Notes
Track M: derive why mean_after - mean_before = (v - mean_before) / (n+1). Median is resistant to a single outlier.
Bình luận