Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

explanation about output of the example

matteo_b (950 points)
14 27 33
in HW3 optional by (950 points)
I can't understand why the output of the example is

    [ (4, ['0001', '0011', '1100' ]),
      (5, ['011', 1000', '110' ]),
      (6, ['0000', '111']),
      (7, ['0010','1001' ]),
      (8, ['0100']),
      (10,['010']),
      (11,['000', '001', '11']),
      (12,['100']),
      (15,['01','10']),
      (23,['00'])
    ]

and not

[(1, ['1101', '1011']),
 (2, ['0101', '1010', '0110']),
 (3, ['101', '0111', '1111', '1110']),
 (4, ['0001', '0011', '1100']),
 (5, ['011', '110', '1000']),
 (6, ['111', '0000']),
 (7, ['1001', '0010']),
 (8, ['0100']),
 (10, ['010']),
 (11, ['11', '001', '000']),
 (12, ['100']),
 (15, ['01', '10']),
 (23, ['00'])]

that is why the result hasn't the frequences (1?), 2, 3.
141 views

2 Answers

k
kacper.niemcewicz (1910 points)
1 2 8
by (1.9k points)

From the exercise description: 

Furthermore, we want to list the n highest frequencies and the
    related segments, where n is a given integer.

 However when you look into the expected output:

    "filename":"ft1.txt",

    "expected":[[1, ["1011", "1101"]], [2, ["0101", "0110", "1010"]],

                [3, ["0111", "101", "1110", "1111"]], [4, ["0001", "0011", "1100"]],

                [5, ["011", "1000", "110"]], [6, ["0000", "111"]], [7, ["0010", "1001"]],

                [8, ["0100"]], [10, ["010"]], [11, ["000", "001", "11"]], [12, ["100"]],

                [15, ["01", "10"]], [23, ["00"]]],

There is a mistake in the description (or the tests) and we don't actually know which is the correct one. You should try both cases and see if the tests pass or not.

D
Danylo (2590 points)
3 6 14
by (2.6k points)
It is just the wrong example in the description, it should list n highest frequencies, not n highest subsequences.