Greedy Algorithms Exercises

  < Previous  Next >
  1. Discuss with your neighbor(s) what makes an algorithm greedy.
  2. Given the following jobs and their required execution times, in what order should they run to minimize the average time to completion?
    What algorithm did you use to schedule the jobs?
      Job     j1     j2     j3     j4  
      Time     7     8     2     1  
  3. Given the following jobs and their required execution times, in what order should they run to minimize the average time to completion if they're allowed to run on 4 cores?
    What algorithm did you use to schedule the jobs?
      Job     j1     j2     j3     j4     j5     j6     j7     j8     j9     j10     j11  
      Time     7     8     2     1     9     8     4     5     1     7     2  
  4. Discuss with your neighbor(s) how Huffman Codes are calculated. Be sure to include in your discussion:
    1. Why they are used
    2. Why the algorithm is greedy?
  5. You've been hired by an international web-ordering company, Nile, to design an algorithm to fit their various-sized products into boxes. Lucky for you, there's only box size. What algorithm are you going to use to determine which product goes into which box? Will it produce the optimum number of boxes?

Last Modified: