Cse 321 HW05
Cse 321 HW05
Homework 05
Deadline: 23:55 December 26th, 2016
PS: Upload your homework to Moodle website. Do not bring papers to the room of the TA.
3. Design a greedy algorithm to solve 0/1 Knapsack Problem1. Describe your greedy approach
in detail. Write a program to show your algorithm including test on a sample set. Write code
in Python. Analyze its best case, worst case, and average case complexities.
4. Design a greedy algorithm to solve Travelling Salesman Problem (TSP) 2 with greedy
approach. Describe your greedy approach in detail. Write a program to show your algorithm
including test on a sample set. Write code in Python. Analyze its best case, worst case, and
average case complexities.
5. Design a greedy algorithm to solve Map Coloring Problem 3. Describe your greedy approach
in detail. Write a program to show your algorithm including test on a sample set. Write code
in Python. Analyze its best case, worst case, and average case complexities.
6. Consider the problem of scheduling n jobs of known durations t1, ..., tn for execution by a
single processor. The jobs can be executed in any order, one job at a time. You want to find a
schedule that minimizes the total time spent by all the jobs in the system. (The time spent by
one job in the system is the sum of the time spent by this job in waiting plus the time spent
on its execution.)
Design a greedy algorithm for this problem. Does the greedy algorithm always yield an optimal
solution? Prove or disprove.
7. Design a greedy algorithm for the assignment problem (see Section 3.4). Does your greedy
algorithm always yield an optimal solution? Prove or disprove.
1 https://en.wikipedia.org/wiki/Knapsack_problem
2 https://en.wikipedia.org/wiki/Travelling_salesman_problem
3 https://en.wikipedia.org/wiki/Map_coloring
8. Write a pseudocode of the greedy algorithm for the change-making problem, with an
amount n and coin denominations d1 > d2 > ... > dm as its input. What is the time efficiency
class of your algorithm?
10. Watch Travelling Salesman (2012), directed by Timothy Lanzone, movie and write an essay.
(It should be minimum half page A-4 paper size or maximum one page A-4 paper size. Also
you are expected to use 1,5 text-space and Times New Roman font family in your essay.)