Algorithms
Spring 2013, Homework # 4
Due: June 10, 2013
1. (20 pts) Let G = (V, E) be a weighted, directed graph with n vertices and m edges, where all
edge weights are nonegative. Dene the bottleneck distance between two vertices as follows:
b (x, y) = m
Algorithm Design and Analysis
Homework #4
Due: 2:20pm, Thursday, November 28, 2013
TA email: [email protected]
= Homework submission instructions =
For Problem 1, commit your source code to the SVN server (katrina.csie.ntu.edu.tw). You
should create a
Algorithm Design and Analysis
Homework #3
Due: 2:20pm, Thursday, October 31, 2013
TA email: [email protected]
= Homework submission instructions =
For Problem 1, commit your source code to the SVN server (katrina.csie.ntu.edu.tw). You
should create a n
Algorithm Design and Analysis
Homework #2
Due: 2:20pm, Thursday, October 17, 2013
TA email: [email protected]
= Homework submission instructions =
For Problem 1, commit your source code and a brief documentation to the SVN server
(katrina.csie.ntu.edu.
Algorithm Design and Analysis
Homework #1
Due: 5pm, Friday, October 4, 2013
TA email: [email protected]
= Homework submission instructions =
For Problem 1, commit your source code and a brief documentation to the SVN server
(katrina.csie.ntu.edu.tw). Y
1. [Grading Rule] One mistake (out of order) costs 2 points.
2
1+
3
O ( 1 ) =192< lg lg n< ln n=lg n< ( lg n ) < n<n<n ( lg n )< n < n
nn3+ 7 n5 <nk <2n < n!
2. [Grading Rule] One sub-problem costs 5 points.
By master theorem
3
log 2 +
) = T ( n ) =(n3 )
Algorithms
Spring 2013, Homework # 1
Due: March 18, 2013
1. (20 pts) List the functions below from lowest to highest order. If any two (or more) are of the
same order, indicate which. (You do not have to formally justify each relation.)
n
2n
nk , where k
Algorithms
Spring 2013, Homework # 2
Due: April 8, 2013
1. (20 pts) Consider the following algorithm to sort the values in array A[p.q]. To sort the entire
array, call New-Sort(A, 1, n). ( denotes assignment and represents swap.)
New-sort(A, p, q)
Begin
I
Algorithms
Spring 2013, Homework # 3
Due: May 6, 2013
1. (25 pts) Describe an ecient algorithm that, given a set cfw_x1 , x2 , ., xn of points on the real
line, determine the smallest set of unit-length closed intervals that contains all the given points
1. [Grading Rule] Algorithm costs 15 pts. Running time costs 5 pts. Correctness
costs 5 pts.
Greedy Solution:
1. Sort the set so that x1 <= x2 <= <= xn.
2. Let xmin be the smallest number in the set.
3. Place the closed interval at [x, x+1].
4. Remove fro
1. [Grading Rule]
(a)
Each sub-problem costs 10 pts.
(b)
No, New-Sort is not stable. Consider the sub-array S:
cfw_41, 42, 23, 24, 35, where the subscript numbers indicate original indices.
After switch the minimum element in S, S becomes:
cfw_23, 42, 41,
Online Algorithms
Introduction
An offline algorithm has a full information in advance so it can
compute the optimal strategy to maximize its profit (minimize its
costs).
An online algorithm is a strategy which at each point in time
decides what to do base
Algorithms
Dep. of Electrical Engineering
National Taiwan University
E-mail: [email protected]
http:/www.ee.ntu.edu.tw/~yen
Spring 2013
(Algorithms )
:
Theme: What is the best algorithm for a given problem
Three things you will learn:
1.
2.
3.
Unit
Algorithm Design and Analysis
Homework #5
Due: 2:20pm, Monday, December 23, 2013
TA email: [email protected]
= Homework submission instructions =
For Problem 1, commit your source code to the SVN server (katrina.csie.ntu.edu.tw). You
should create a ne
National Taiwan University
Department of Electrical Engineering
Algorithms, Fall 2016
Handout #6
October 19, 2016
TA: Zhi-Wen Lin and Yen-Chun Liu
Sample Solutions to Homework #1
1. (10)
(a) See Figure 1.
A L G O R
I T1 H M N T2 U E1 E2
A L G O R
I T1 H M
National Taiwan University Department of Electrical Engineering Algorithms, Fall 2009
Handout #9 October 29, 2009 Yao-Wen Chang
Name:
Student ID:
Web ID:
Problem 1. (24 pts total) Given four matrices A1 , A2 , A3 , A4 of dimensions 3 1, 1 2, 2 5, 5 7, res
National Taiwan University Department of Electrical Engineering Algorithms, Fall 2009
Handout #15 December 10, 2009 Yao-Wen Chang
Name:
Student ID:
Web ID:
Problem 1. (15 pts total) A group of n girls and n boys are attending a dance class. The instructor
National Taiwan University Department of Electrical Engineering Algorithms, Fall 2009
Handout #19 December 31, 2009 Yao-Wen Chang
Name:
Student ID:
Web ID:
Problem 1. (8 pts total) Does either Prims or Kruskals minimum-spanning-tree algorithm work if ther
Unit 2: Sorting and Order Statistics
Course contents:
Heapsort
Quicksort
Sorting in linear time
Order statistics
Readings:
Chapters 6, 7, 8, 9
Algorithm
Runtime
Best case
Insertion
Unit 2
Average
case
Properties
Worst case
Stable?
In-place?
2
2
Yes
Yes
Me
National Taiwan University
Department of Electrical Engineering
Algorithms, Fall 2016
Handout #2
September 22, 2016
Yao-Wen Chang
Homework #1 (due in-class, October 13, 2016)
1. Work on (a) Exercise 2.1-1 (page 22) and (b) Exercise 2.3-1 (page 37) based o
Unit 6: Amortized Analysis
Course contents:
Aggregate method
Accounting method
Potential method
Reading:
Unit 6
Chapter 17
Y.-W. Chang
1
Amortized Analysis
Why Amortized Analysis?
Find a tight bound of a sequence of data structure
operations.
No probabili
Algorithms
EE4033; #901/39000
Yao-Wen Chang
[email protected]
http:/cc.ee.ntu.edu.tw/~ywchang
Graduate Institute of Electronics Engineering
Department of Electrical Engineering
National Taiwan University
Fall 2016
Administrative Matters
Course#: EE4033;
Unit 7: Graphs
Course contents:
Elementary graph algorithms
Minimum spanning trees
Shortest paths
Maximum flow
Reading:
Unit 7
Chapters 22, 23, 24, 25
Chapter 26.126.3
Y.-W. Chang
1
Graphs
A graph G = (V, E) consists of a set V of vertices
(nodes) and a s
National Taiwan University
Department of Electrical Engineering
Algorithms, Fall 2016
Handout #4
October 9, 2016
Yao-Wen Chang
Homework #2 (due in-class, November 3, 2016)
1. Work on (a) Exercise 6.4-1 (page 160), (b) Problem 7.1(a): Hoare partition (page
Unit 8: Coping with NP-Completeness
Course contents:
Complexity classes
Reducibility and NP-completeness proofs
Coping with NP-complete problems
Reading:
Unit 8
Chapter 34
Chapter 35.1, 35.2
Y.-W. Chang
1
Complexity Classes
Developed by S. Cook and R. Ka
Unit 3: Tree Data Structures
Course contents:
Binary search trees
Red-black trees
Interval trees
Readings:
Unit 3
Chapters 10 (self reading), 12, 13, and 14 (self reading
for Chapter 14)
Y.-W. Chang
1
Example Floorplans
Intel
Core
i7-3960X
(2011)
Intel
P4
National Taiwan University
Department of Electrical Engineering
Algorithms, Fall 2016
Handout #7
October 19, 2016
TAs: Zhi-Wen Lin and Yen-Chun Liu
Sample Solutions to Quiz #1
1. Apply lg operation to n0.5 ,
lg n
n (lg n)2 , and (lg n)
0.5 lg n, 0.5(lg n)
National Taiwan University Department of Electrical Engineering Algorithms, Fall 2009
Handout #4 October 8, 2009 Yao-Wen Chang
Name:
Student ID:
Web ID:
Problem 1. (12 pts) For the following functions, rank them from the slowest (with the lowest complexit