From fa7cbaee4baf174ee416280d82a60fade6d3eaad Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Mon, 13 Feb 2017 22:00:06 +0700 Subject: Add /r/dailyprogrammer Challenge #302 [Hard] --- daily/302hard/README.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 daily/302hard/README.md (limited to 'daily/302hard/README.md') diff --git a/daily/302hard/README.md b/daily/302hard/README.md new file mode 100644 index 0000000..3afdca3 --- /dev/null +++ b/daily/302hard/README.md @@ -0,0 +1,90 @@ +# [[2017-02-10] Challenge #302 [Hard] ASCII Histogram Maker: Part 2 - The Proper Histogram](https://www.reddit.com/r/dailyprogrammer/comments/5t7l07/20170210_challenge_302_hard_ascii_histogram_maker/) + +## Description + +Most of us are familiar with the histogram chart - a representation of a +frequency distribution by means of rectangles whose widths represent class +intervals and whose areas are proportional to the corresponding frequencies. It +is similar to a bar chart, but a histogram groups numbers into ranges. The area +of the bar is the total frequency of all of the covered values in the range. + +## Input Description + +You'll be given four numbers on the first line telling you the start and end of +the horizontal (X) axis and the vertical (Y) axis, respectively. The next line +tells you the interval for the X-axis to use (the width of the bar). Then +you'll have a number on a single line telling you how many records to read. +Then you'll be given the data as 2 numbers: the first is the variable, the +second number is the frequency of that variable. Example: + + 1 4 1 10 + 2 + 4 + 1 3 + 2 3 + 3 2 + 4 6 + +## Challenge Output + +Your program should emit an ASCII histogram plotting the data according to the +specification - the size of the chart and the frequency of the X-axis, +variables. Example: + + 10 + 9 + 8 + 7 + 6 + 5 + 4 *** + 3*** *** + 2*** *** + 1*** *** + 1 2 3 4 + +# Challenge Input + + 0 40 0 100 + 8 + 40 + 1 56 + 2 40 + 3 4 + 4 67 + 5 34 + 6 48 + 7 7 + 8 45 + 9 50 + 10 54 + 11 20 + 12 24 + 13 44 + 14 44 + 15 49 + 16 28 + 17 94 + 18 37 + 19 46 + 20 64 + 21 100 + 22 43 + 23 23 + 24 100 + 25 15 + 26 81 + 27 19 + 28 92 + 29 9 + 30 21 + 31 88 + 32 31 + 33 55 + 34 87 + 35 63 + 36 88 + 37 76 + 38 41 + 39 100 + 40 6 -- cgit 1.4.1