The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP5711
AdvancedAlgorithms
KeYi
DeptCSE,HKUST
BackgroundRequirements
COMP3711(Undergradalgorithmscourse)
Sortingandsearching,divide&conquer,greedy,dynamicprogramming,graph
algorithms(MST,shortestpath,etc.),
Analysisofalgorithms
NPcompleteness
s
s
s
Basic
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithm
2014 Fall Semester
Midterm Exam Solutions
Problem 1 (15pts)
(a) k = O(log n/ log log n).
Proof: kk = nO(1) k log k = O(log n). When k = O(log n/ log log n), this certainly
holds. Meanwhile, we cant have k = (log n/ log log n)
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Coping With NPCompleteness
Q. Suppose I need to solve an NPcomplete problem. What should I
do?
A. Theory says you're unlikely to find polytime algorithm.
Must sacrifice at least one of three desired features.
Solve problem in polynomial time.
Solve pro
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Coping With NPHardness
Q. Suppose I need to solve an NPhard problem. What should I do?
A. Theory says you're unlikely to find polytime algorithm.
Must sacrifice one of three desired features.
Solve arbitrary instances of the problem.
Solve problem to o
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Approximation Algorithms
Q. Suppose I need to solve an NPhard problem. What should I do?
A. Theory says you're unlikely to find a polytime algorithm.
Must sacrifice one of three desired features.
Solve problem to optimality.
Solve problem in polytime.
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Randomization
in practice, access to a pseudorandom number generator
Randomization. Allow fair coin flip in unit time.
Why randomize? Can lead to simplest, fastest, or only known algorithm
for a particular problem.
Big open question: Can a randomized alg
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Randomization
in practice, access to a pseudorandom number generator
Randomization. Allow fair coin flip in unit time.
Why randomize? Can lead to simplest, fastest, or only known
algorithm for a particular problem.
Big open question: Can a randomized alg
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Our solution will be similar to the algorithm for VERTEX COVER from the rst section
of this chapter. Consider the notation dened in the problem. For an element a E A, we
reduce the instance by a by deleting a from A, and deleting all sets B, that contain
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
We root the tree at some node 7 and associate a subtree T0 with each node U E T, and
let n, denote the number of nodes in the subtree To. A solutions for the graph partitioning
problem may split the subtree To in any ratio, however, it is not hard to see
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithms
Fall 2014 Midterm Exam
Instructions
1. Print your name, student ID at the top of every page (in case the staple falls out!).
2. This is a openbook, opennotes, openbrain exam.
3. Time limit: 120 minutes.
4. You can write o
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithm
2014 Fall Semester
Assignment 4
Chapter 13
Problem 11 (20 pts) Suppose you assign k jobs to k machines, each job to any of the k machines uniformly
and independently at random.
(a) Let N (k) be the expected number of machines
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithm
2014 Fall Semester
Assignment 3
Amortized Analysis (CLRS Ch 17)
Problem 172 (25 pts) The logarithmic method is a general technique to make a static data structure dynamic. Here we see how we apply it on a sorted array. We kn
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Big data algorithms
Google trend
Is there anything
fundamentally new?
Massive Data vs Big Data
The 3 Vs
Volume
Velocity
Variety
Big data Applications
Big Data Algorithms
Parallel/Distributed
External memory Data stream Algorithms
Algorithms
Algorithms
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithm
2014 Fall Semester
Written Assignment # 1
Chapter 10
Problem 1 (20pts) We claimed that the Hitting Set Problem was NPcomplete. To recap the denitions, consider a set A = cfw_al .an and a collection B1 , B2 , . . . , Bm
of s
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
COMP 5711: Advanced Algorithm
2014 Fall Semester
Written Assignment # 2
Chapter 11
Problem 11 (20 pts) Consider the following variant of the knapsack problem. There
are n items, each with a weight wi and a value vi . Now, youre told that
there is a subset
The Hong Kong University of Science and Technology
Advanced Algorithms
COMP 5711

Fall 2014
Problem 17.2
(a) There are O(log n) arrays and we need to query each of them. So the total query time
is O(log2 n). Although the query time decreases as the array size gets smaller, but that
doesnt change the asymptotic bound.
(b) Recall that merging two