Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Greedy algorithms

1.[3p]

What exactly does the greedy choice property claim?

Correct
The answer is: Some optimal solution contains the choice the greedy rule makes first
The answer is: Some optimal solution contains the choice the greedy rule makes first
The answer is: Some optimal solution contains the choice the greedy rule makes first

2.[2p]

For interval scheduling, the rule that works is

Correct
The answer is: take the talk that finishes earliest
The answer is: take the talk that finishes earliest
The answer is: take the talk that finishes earliest

3.[3p]

Apply that rule to the intervals (1,4), (3,5), (0,6), (5,7), (3,8), (5,9), (6,10), (8,11), (8,12), (2,13), (12,14). How many talks are scheduled?

CorrectNot quite: 4

4.[2p]

How many would the earliest-start rule schedule on that same set?

CorrectNot quite: 3

5.[3p]

Six symbols occur 40, 20, 15, 12, 8 and 5 times. How many bits does the Huffman code take for the whole 100-symbol message?

CorrectNot quite: 233

6.[2p]

What percentage does that save against a fixed-width three-bit code?

CorrectNot quite: 22.3

7.[2p]

Huffman coding reaches Shannon's entropy exactly.

The answer is: False
Correct

8.[3p]

A bag holds 50 kg. Items are worth 60 at 10 kg, 100 at 20 kg and 120 at 30 kg. What value does the greedy ratio rule achieve on the 0/1 problem?

CorrectNot quite: 160

9.[3p]

Greed fails on 0/1 knapsack but not on fractional knapsack because

Correct
The answer is: with whole items there is no unit to exchange, so the exchange argument has nothing to work with
The answer is: with whole items there is no unit to exchange, so the exchange argument has nothing to work with
The answer is: with whole items there is no unit to exchange, so the exchange argument has nothing to work with