COP 4531: Lecture 21
Learning objectives
After this class, you should be able to:
- Given a set of activities, their start times, and their end times, give an optimal solution to the activity selection problem.
- Given a set of characters and their frequencies, construct the Huffman tree and determine the Huffman code for each character.
- Given a problem, give an optimal substructure property, prove this property, construct a greedy algorithm, prove its correctness and optimality, and derive the time complexity of your algorithm.
- Given a greedy strategy, give a counterexample to show that it is not optimal.
Reading assignment
- CLR: Sections 16.1 - 16.3.
- CLR: Chapter 22, pages 529 and 541.
Exercises and review questions
- Questions on current lecture's material
- Exercise 16.1-4.
- Exercise 16.2-4.
- Exercise 16.3-2.
- Questions on next lecture's material
- (Post your solution on the discussion board) Give a graph with six vertices, give its adjacency matrix, and show the order in which a depth first search will traverse the vertices (also mention the starting vertex).