Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***This supposed to creat Bar chart*** as attach picture here.*** /** * Returns the length of the array, items, * by using a single call

***This supposed to creat Bar chart*** as attach picture here.*** image text in transcribed /** * Returns the length of the array, items, * by using a single call to reduce. */ function len(items) { } /** * Takes an array of numbers and returns an array of size 2, * where the first element is the smallest element in items, * and the second element is the largest element in items. * * Must do this by using a single call to reduce. * * For example, minMax([4, 1, 2, 7, 6]) returns [1, 7] */ function minMax(items) { } /** * Takes an array of items, and returns a Map with the * frequencies (counts) of each item in the array. * * Must do this by using a single call to reduce. * * For example, * freqs([1, 2, 3, 2, 7, 2, 1]) returns Map {1 => 2, 2 => 3, 3 => 1, 7 => 1} * freqs("One fish two fish red fish blue fish".split(' ')) * returns Map {"One" => 1, "fish" => 4, "two" => 1, "red" => 1, "blue" => 1} */ function freqs(items) { } /** * Takes as input a string containing numbers separated by newlines (see data below). * Uses string split, and then map, filter, and reduce solely to compute * the frequency, as a Map, of the first digit of each number * (except for numbers starting with 0). * It must throw away numbers that start with 0 and blank entries. * The returned Map must contain numbers as keys -- NOT strings containing numbers! * * For example, benford(sample1) returns Map {1 => 3, 2 => 2, 3 => 2, 7 => 2, 9 => 1} * benford(sample2) returns Map {1 => 3, 2 => 2, 3 => 2, 7 => 2, 9 => 1} */ function benford(strNums) { } // data for benford // NOTE: So you don't have to search to find the variables, the names of the variables are // sample1, sample2, livejournal, librarybooks, & sunspots let sample1 = '101481 10974 1013 28292 35040 35372 7155 7284 96110 26175 '; let sample2 = '101481 10974 1013 0 28292 35040 35372 7155 7284 96110 26175 '; let livejournal = '10 4 12 5 7 8 5 15 11 3 3 2 6 2 9 6 6 3 9 7 7 13 7 11 6 12 14 4 15 9 12 6 11 9 8 6 9 7 10 5 9 12 3 6 5 13 8 5 9 12 6 7 8 12 6 7 9 12 9 11 8 8 3 9 13 13 8 5 13 5 13 10 10 10 7 13 37 8 9 8 6 12 7 8 8 8 7 4 2 12 15 10 9 23 13 14 24 13 10 9 15 25 24 23 16 12 12 12 24 14 9 18 18 19 27 27 39 46 46 30 26 69 72 47 61 32 34 38 89 57 71 63 60 31 45 38 45 53 46 64 47 40 65 59 65 62 59 39 73 82 65 95 75 74 54 60 78 68 83 89 59 76 82 104 92 74 91 80 80 82 90 76 86 78 67 60 76 62 76 85 79 72 72 85 77 62 78 69 78 83 96 90 100 88 98 94 82 87 111 126 118 120 101 73 79 110 87 97 95 98 78 119 111 113 144 109 108 87 133 109 96 112 139 108 92 129 151 176 127 132 129 115 132 152 147 144 145 119 113 115 134 130 130 136 152 133 141 149 157 157 141 109 137 159 184 172 158 122 131 130 154 144 177 147 130 122 129 121 101 113 132 136 113 112 145 152 156 151 161 138 108 165 192 197 191 181 158 148 202 182 188 185 164 161 177 188 208 194 179 162 137 147 181 180 146 180 178 135 166 200 183 148 177 164 197 272 302 259 276 274 254 235 201 258 253 249 228 222 198 217 287 241 252 243 274 228 210 262 287 312 287 261 264 266 273 288 250 252 280 248 313 314 291 313 372 268 286 287 241 219 157 259 244 271 309 269 382 334 254 197 21 446 257 285 322 370 353 348 419 431 446 433 440 412 390 446 533; 
let librarybooks = '12201 600778 14926 37863 14866 9896 8064 9047 3388 21625 8779 7150 9441 10993 7850 7445 276157 13902 13078 8658 22852 21803 17050 34419 3240 106000 8365 74343 55626 65248 15390 11693 8248 14566 11296 11300 17926 2199 42999 7842 28966 11068 2733 11538 29684 57448 11824 34681 10701 4000 13555 7685 6850 11500 46628 57232 21774 45531 8700 6520 10741 8458 43690 11735 18558 3213 4802 6500 4952 9255 4600 1050 7178 3817 991 14064 4200 4680 2566 4830 2781 5884 6564 1770 8150 1200 6274 9209 6730 9736 9577 54347 10750 17744 22453 15495 88085 23106 23881 14369 13288 13342 26620 138631 29630 6456 51633 15024 55406 6560 5269 11154 11754 14327 69097 13712 34644 41658 7411 11049 14406 39325 12748 16919 11355 18477 8413 10575 120267 30003 10964 10797 56317 54178 32269 4585 21266 16778 81866 23214 9286 36808 22391 60835 80181 15646 4595 15938 9427 18406 11948 5194 9703 25570 3379 55179 97155 28351 31501 13491 35222 48916 39503 48070 7462 4844 29115 34509 12115 68787 118471 38206 27880 54581 21749 84371 195148 39567 39269 33270 12361 30505 37559 63084 91828 24002 838199 79263 6795 36426 37444 7296 71540 39958 19368 202166 26299 45832 27269 6935 6544 43506 48289 49780 82463 12723 42096 19472 20769 25133 8079 15416 37707 6741 57895 16424 10223 9546 11191 17386 11239 14107 5074 30045 15093 24360 130751 48702 31434 3488 194374 29466 18207 19836 66204 64165 27097 7081 555157 15157 30990 13139 24089 20136 19702 19883 13268 41111 27591 15572 10690 9594 12098 75849 45096 31572 457317 548606 10524 13403 11173 8708 72595 24567 64146 73135 181323 42924 25447 80336 63823 9941 9803 20787 10975 37746 14269 13948 6840 6884 4669 7360 26544 12848 5750 20679 5903 11108 6066 6000 6012 3576 626802 323714 68950 256432 146451 113823 169210 167050 128452 125888 232511 137767 135473 141629 85552 154027 161829 94505 65116 109057 79587 39405 50078 80361 55431 85707 32564 66274 33645 41525 66650 305203 161068 105987 10600 28347 80294 89581 106637 97307 69884 15817 69033 47380 13431 60125 20692 62714 292561 289798 25450 76888 28834 516480 31116 26232 336551 553520 688918 1569039 684252 465367 21309 36489 188376 12027 364599 1287502 59218 11881 471204 238364 12650 39278 177256 50731 258261 13433 26111 13926 174283 4096 1010590 207224 153206 13719 134678 80796 451345 158548 292661 122653 433829 317077 46777 98397 324340 233170 280172 84372 58375 280458 86599 197680 415154 80902 99826 77408 101488 1109564 133059 94504 157165 50040 41198 122170 122775 331712 166878 229846 294739 1051127 260375 643741 75207 187754 70277 455137 62105 26859 460092 87357 996400 196968 89976 48381 17900 198899 135550 112096 973297 8146469 5765741 203094 369012 172779 140942 352997 123411 70083 95143 127276 333091 111953 161317 282374 162955 164321 176684 359139 1085403 256474 189563 2694942 276443 63836 329335 100272 122449 152913 237365 243647 51837 751950 50403 110969 73324 306248 83950 211363 210989 215493 415140 214747 1874695 215071 48086 116472 1045178 241439 100285 1286024 2897216 2165833 1574771 8717 241222 420249 107871 465719 306789 121846 349895 373602 296616 1373197 467184 80400 189748 356077 71841\; 
let sunspots = '58 63 70 56 85 84 95 66 76 76 159 85 73 76 89 88 90 100 85 103 91 66 63 75 70 44 45 56 61 51 66 60 24 23 29 44 35 50 71 59 60 40 78 29 27 47 38 40 44 32 46 38 36 32 22 39 28 25 20 7 0 3 2 14 21 27 19 12 8 24 13 4 10 11 7 7 0 0 9 3 18 24 7 20 13 7 5 9 13 13 4 6 12 14 17 9 14 21 26 30 38 13 25 51 40 33 65 34 38 52 49 72 46 45 44 39 63 38 43 43 48 44 47 47 49 50 51 71 77 60 46 57 67 60 75 58 72 48 66 76 61 51 60 61 70 91 81 72 107 99 94 91 101 89 90 46 44 73 46 60 40 77 34 68 69 69 78 77 57 32 34 33 33 36 54 27 68 46 61 61 60 60 40 34 44 30 30 30 28 28 26 26 24 26 25 22 20 20 27 30 16 14 14 13 12 11 37 6 27 3 3 4 4 5 6 19 27 30 43 33 30 33 22 41 43 44 55 53 54 66 46 43 78 77 53 67 75 78 91 112 74 64 64 97 74 94 119 120 149 158 148 112 104 143 80 51 70 83 110 126 104 104 132 102 36 46 47 65 153 120 68 59 101 90 100 96 101 91 31 92 38 57 77 56 51 79 61 64 55 29 51 33 41 28 28 13 29 26 41 43 47 65 56 44 51 29 18 7 8 14 18 12 4 0 12 11 4 12 1 8 3 6 15 8 22 12 6 22 11 19 1 24 16 30 35 40 45 37 39 96 80 81 95 112 116 107 146 157 177 109 134 145 239 172 153 140 172 156 150 105 115 166 118 145 140 114 143 112 111 124 114 110 70 98 98 95 107 88 86 86 94 77 60 59 99 75 53 68 105 98 74 66 51 27 67 35 54 38 37 41 54 38 37 44 34 23 32 30 28 39 27 28 23 25 32 20 18 8 15 11 13 8 11 10 6 9 6 10 10 8 17 14 7 8 9 16 21 26 36 20 32 47 40 27 37 48 48 85 92 59 83 90 112 112 116 113 135 106 87 127 135 99 128 137 157 157 142 174 138 129 143 109 113 154 142 136 141 142 95 130 114 125 120 123 124 120 117 103 112 90 134 136 103 128 96 94 93 91 69 87 77 84 82 74 73 62 74 77 74 64 71 43 67 62 67 66 58 64 63 76 62 61 46 60 59 59 57 56 56 55 56 53 52 51 50 29 24 47 44 46 45 44 38 28 56 42 41 40 11 29 67 51 21 40 13 19 31 17 13 26 14 20 25 18 22 24 16 32 21 7 27 2 18 11 8 5 14 4 4 4 7 11 4 6 6 7 6 3 2 4 12 1 0 0 0 3 2 2 13 10 2 13 22 8 8 11 2 0 0 5 3 9 7 9 14 0 5 24 21 20 12 12 11 40 27 29 30 31 32 31 35 39 34 33 40 48 48 47 41 42 44 46 48 50 52 39 35 50 50 51 30 25 44 36 48 34 45 54 51 48 45 48 48 51 33 35 30 43 53 62 61 60 61 44 51 38 39 41 38 43 44 29 41 38 39 30 33 28 26 26 30 26 24 27 25 24 12 12 10 24 10 12 13 12 6 8 3 0 0 5 0 12 14 14 7 8 12 5 11 12 7 9 1 3 2 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 2 6 1 1 11 2 1 0 1 1 1 16 5 4 8 10 0 10 2 17 6 11 18 8 15 28 17 14 22 12 6 24 6 15 19 2 8 19 15 20 19 32 26\; 

Benford Choose dataset livejournal v livejoumal library books sunspots 60 45 30 15 Digit livejournal Benford

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago