A Violin Plot: Box Plot Meets KDE
Ironbark Manufacturing uses a fatter version of the box chart whose outline bulges where measurements cluster, so a supervisor can see whether a machine produces one tight run or two separate populations — something a plain box cannot show. The quality note still quotes a plain number for machine A: the span of its middle half, which is the height of the box hidden inside the outline.
Task: Print the span of machine A's middle half.
Input
The first line holds one integer n, the number of measurements. Each of the next n lines holds a machine name and one measurement, separated by a single space. Machine names contain no spaces.
Output
One line with exactly two decimal places: for machine A alone, the upper quarter-point less the lower quarter-point. A quarter-point that falls between two measurements is taken by sliding evenly between them, so four measurements of 10, 20, 30 and 40 give quarter-points of 17.5 and 32.5.
Example:
Input:
5
A 10
A 20
A 30
A 40
B 100
Output:
15.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in