CMSC 451:Fall 2013
Dave Mount
Homework 2: Greedy Algorithms
Handed out Thu, Oct 3. Due at the start of class Thu, Oct 17. Late homeworks are not accepted, but you
may drop your lowest homework score.
CMSC 451:Fall 2013
Dave Mount
Solutions to Homework 2: Greedy Algorithms
Solution 1:
(a) Let (s1 , p1 ) = (1, 0.1) and (s2 , p2 ) = (2, 0.9). If we put f1 before f2 (size order), the expected access
c
COMP 271 Design and Analysis of Algorithms 2004 Fall Semester Question Bank 3
Solving these questions will give you good practice for the midterm exam. Some of these questions (or similar ones) will d
Max Flow, Min Cut, and Matchings (Solution)
1. The gure below shows a ow network on which an s-t ow is shown.
The capacity of each edge appears as a label next to the edge, and the
numbers in boxes gi
The Hong Kong University of Science & Technology COMP 271: Design and Analysis of Algorithms Fall 2007 Tutorial 6: Knapsack & MCM
Below is the suggest solution to the tutorial questions. Question 1 :
Analysis of Algorithms
Algorithm. An algorithm is a description of the
steps needed to solve a problem. Each step is a
computation that should be supported by some basic primitive oered by a computer
The Hong Kong University of Science & Technology COMP 271: Design and Analysis of Algorithms Fall 2007 Solution to Assignment 1
Idea of the algorithm: If we divide A into two roughly equal size sub-ar
The Hong Kong University of Science & Technology COMP 271: Design and Analysis of Algorithms Fall 2007 Assignment 1
Assigned: 6/9/07 Due Date: 4pm, 18/9/07 Question 1 : Let A[] be an array of positive
Part VI: Dealing with Hard Problems
Lecture 18: Approximation algorithms
Lecture 18: Approximation algorithms
Part VI: Dealing with Hard Problems
Objective and Outline
Objective: Introduction to appro
Part VI: Dealing with Hard Problems
Lecture 17: NP-Completeness
Lecture 17: NP-Completeness
Part VI: Dealing with Hard Problems
Objective and Outline
Objective: Introduce NP-completeness and show how
The Hong Kong University of Science & Technology COMP 271: Design and Analysis of Algorithms Fall 2007 Solution to Assignment 2
In the DSelection algorithm described in Lecture 5, input elements are d
Part II: Graph Algorithms
Lecture 6: Depth-First Search and Its Applications
Lecture 6: Depth-First Search and Its Applications
Part II: Graph Algorithms
Intro to Part II: What are graphs?
A graph is
Part VI: Dealing with Hard Problems
Lecture 16: Problem Classes P & NP
Lecture 16: Problem Classes P & NP
Part VI: Dealing with Hard Problems
Introduction to Part VI
So far: techniques for designing e
Part II: Graph Algorithms
Lecture 7: Minimum Spanning Trees and Prims Algorithm
Lecture 7: Minimum Spanning Trees and Prims Algorithm
Part II: Graph Algorithms
Objective and Outline
Objective: Introdu
Part II: Graph Algorithms
Lecture 8: Kruskals MST Algorithm
Lecture 8: Kruskals MST Algorithm
Part II: Graph Algorithms
Objective and Outline
Objective: Discuss another algorithm for the MST problem,
Part II: Graph Algorithms
Lecture 9: Dijkstras Shortest Path Algorithm
Lecture 9: Dijkstras Shortest Path Algorithm
Part II: Graph Algorithms
Objective and Outline
Objective: Discuss a third graph pro
Part III: Dynamic Programming
Lecture 10: The 0-1 Knapsack Problem
Lecture 10: The 0-1 Knapsack Problem
Part III: Dynamic Programming
Introduction to Part III
What is dynamic programming? A technique
Part III: Dynamic Programming
Lecture 11: Chain Matrix Multiplication
Lecture 11: Chain Matrix Multiplication
Part III: Dynamic Programming
Objective and Outline
Objective: Another example of dynamic
Part III: Dynamic Programming
Lecture 12: All-Pairs Shortest Paths
Lecture 12: All-Pairs Shortest Paths
Part III: Dynamic Programming
Objective and Outline
Objective: A third example of dynamic progra
Part IV: Greedy Algorithms
Lecture 13: The Fractional Knapsack Problem
Lecture 13: The Fractional Knapsack Problem
Part IV: Greedy Algorithms
Objective and Outline
Objective: Illustrate greedy algorit
Part IV: Greedy Algorithms
Lecture 14: Human Coding
Lecture 14: Human Coding
Part IV: Greedy Algorithms
Objective and Outline
Objective: Another example of greedy algorithms Reference: Section 16.3 of
Part V: String Matching
Lecture 15: String Matching
Lecture 15: String Matching
Part V: String Matching
Objective and Outline
Objective: Discuss some basic string algorithms Reference: Chapter 34 of C
CMSC 451:Fall 2013
Dave Mount
Homework 1: Algorithm Design Basics
Handed out Thu, Sep 12. Due at the start of class Tue, Sep 24. Late homeworks are not accepted, but you
may drop your lowest homework
CMSC 451:Fall 2013
Dave Mount
Solutions to Homework 1: Algorithm Design Basics
Solution 1: Throughout, let X = cfw_x1 , . . . , xn denote the set of men, and let Y = cfw_y1 , . . . , yn denote the
s
COMP 2711 Discrete Mathematical Tools for CS
Spring 2016 Written Assignment # 4
Distributed: March 9, 2016 Due: March 16, 2016
Solutions
Your solutions should contain (i) your name, (ii) your student
COMP 2711 Discrete Mathematical Tools for CS
Spring Semester, 2016
Written Assignment # 8
Distributed: 22 April 2016 Due: 4pm, 29 April 2016
Solution Keys
Your solutions should contain (i) your name,
COMP 2711 Discrete Mathematical Tools for Computer Science
2016 Spring Semester Assignment # 2
Distributed: 19 February 2016 Due: 4pm, 26 February 2016
Your solutions should contain (i) your name, (ii
COMP 2711 Discrete Mathematical Tools for Computer Science
2016 Spring Semester Assignment # 3
Distributed: 26 February 2016 Due: 4pm, 09 March 2016
Solutions
Your solutions should contain (i) your na
COMP 2711 Discrete Mathematical Tools for CS
Spring Semester, 2016
Written Assignment # 7
Distributed: 13 April 2016 Due: 4pm, 20 April 2016
Your solutions should contain (i) your name, (ii) your stud
COMP 2711 Discrete Mathematical Tools for CS
Spring Semester, 2016
Written Assignment # 9
Distributed: 29 April 2016 Due: 4pm, 6 May 2016
Solution Keys
Your solutions should contain (i) your name, (ii