So my professor asked this on the test the other day and I am not sure I got it right. A mailman has only one hour to deliver as many letters as possible(one by one). In order to deliver a letter in distance n it takes 5 + 0 .5logn minutes (log with base 3). He decides which letters he will deliver using a greedy algorithm. If the distances of each letter is given in the matrix how many letters will he deliver? A = 3, 3, 3, 9, 9, 3, 3, 27, 27, 27, 81, 9, 81, 81
I thought that he will choose to deliver the letters with the minimum distance first because these take less time (so the ones with distance 3, then those with a distance of 9 etc...). So my answer was 5 letters with distance 3 (time = 27.5), then 3 letters with distance 9 (18 additional minutes, so the total is 45.5) and then 2 of distance 27 so the total time is 58.5 . Am I thinking this right???