Cody

# Problem 87. Indexed Probability Table

Solution 1129173

Submitted on 23 Feb 2017 by Raymundo Carranza
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = [4 4 4 4]; p_correct = [0 0 0 1]; assert(isequal(prob_table(x),p_correct))

idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 1 2 3 4

2   Pass
x = [1 2 1 2 1 2 1 2 1 2]; p_correct = [0.5 0.5]; assert(isequal(prob_table(x),p_correct))

idx = 1 3 5 7 9 idx = 2 4 6 8 10

3   Pass
x = [1 1 2 8]; p_correct = [0.5 0.25 0 0 0 0 0 0.25]; assert(isequal(prob_table(x),p_correct))

idx = 1 2 idx = 3 idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 1×0 empty double row vector idx = 4

4   Pass
x = 1:100; p_correct = 0.01*ones(1,100); assert(isequal(prob_table(x),p_correct))

idx = 1 idx = 2 idx = 3 idx = 4 idx = 5 idx = 6 idx = 7 idx = 8 idx = 9 idx = 10 idx = 11 idx = 12 idx = 13 idx = 14 idx = 15 idx = 16 idx = 17 idx = 18 idx = 19 idx = 20 idx = 21 idx = 22 idx = 23 idx = 24 idx = 25 idx = 26 idx = 27 idx = 28 idx = 29 idx = 30 idx = 31 idx = 32 idx = 33 idx = 34 idx = 35 idx = 36 idx = 37 idx = 38 idx = 39 idx = 40 idx = 41 idx = 42 idx = 43 idx = 44 idx = 45 idx = 46 idx = 47 idx = 48 idx = 49 idx = 50 idx = 51 idx = 52 idx = 53 idx = 54 idx = 55 idx = 56 idx = 57 idx = 58 idx = 59 idx = 60 idx = 61 idx = 62 idx = 63 idx = 64 idx = 65 idx = 66 idx = 67 idx = 68 idx = 69 idx = 70 idx = 71 idx = 72 idx = 73 idx = 74 idx = 75 idx = 76 idx = 77 idx = 78 idx = 79 idx = 80 idx = 81 idx = 82 idx = 83 idx = 84 idx = 85 idx = 86 idx = 87 idx = 88 idx = 89 idx = 90 idx = 91 idx = 92 idx = 93 idx = 94 idx = 95 idx = 96 idx = 97 idx = 98 idx = 99 idx = 100