Homework #3
Solutions
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, Feb 18th, 11.59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student
Solutions
Homework #1
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, February 4rd, 5pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student
Homework #5
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, March 3rd, 11.59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student assessme
Homework #9
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Friday, Apr 29, 11:59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student assessment
Pl
Quiz #2
Introduction to Algorithms/Algorithms 1
600.363/463
Tuesday, April 2nd, 9-10.15am
Ethics Statement
I agree to complete this exam without unauthorized assistance from any person, materials, or device.
Name
Signature
Date
1
Problem 1 (20 points)
In
Homework #8
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, March 24th, 11.59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student assessm
Solutions
Homework #4
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, Feb 25th, 11.59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student
Homework #6
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, March 24th, 11.59pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under student assessm
Solutions
Homework #2
Introduction to Algorithms/Algorithms 1
600.363/463
Spring 2016
Due on: Thursday, February 11th, 5pm
Late submissions: will NOT be accepted
Format: Please start each problem on a new page.
Where to submit: On blackboard, under studen
Quiz #2
Introduction to Algorithms/Algorithms 1
600.363/463
April 7th, 9:00-10:15am
Ethics Statement
I agree to complete this exam without unauthorized assistance from any person, materials, or device.
Signature
Date
1
Problem 1 (20 points)
Define a stron
15-451/651: Design & Analysis of Algorithms
Lecture #7: Hashing
September 15, 2016
last changed: September 15, 2016
Hashing is a great practical tool, with an interesting and subtle theory too. In addition to its use as
a dictionary data structure, hashin
600.463 Introduction to Algorithms / Algorithms I
Topic: Dynamic Programming I
11.1
Lecturer: Michael Dinitz
Date: 10/6/16
Introduction
Dynamic programming can be very confusing until youve used it a bunch of times, so the best way
to learn it is to simpl
600.463 Introduction to Algorithms / Algorithms I
Topic: Probabilistic Analysis, randomized quicksort
3.1
Lecturer: Zeyu Zhang
Date: 9/8/16
Introduction
As we discussed the first lecture, one issue with trying to do an average-case analysis of an
algorith
600.463 Introduction to Algorithms / Algorithms I
Topic: Sorting lower bound and Linear-time sorting
5.1
Lecturer: Michael Dinitz
Date: 9/15/16
Introduction
You should all know a few ways of sorting in O(n log n) time, most notably mergesort and heapsort
600.463 Introduction to Algorithms / Algorithms I
Topic: Basic Graph Algorithms
13.1
Lecturer: Michael Dinitz
Date: 10/13/16
Introduction
Graphs are an incredibly important abstraction in computer science, so there has been a huge
amount of work on algori
600.463 Introduction to Algorithms / Algorithms I
Topic: Linear time selection/median
4.1
Lecturer: Michael Dinitz
Date: 9/13/16
Announcements
1. First homework due right now.
2. Second homework released today, due in a week.
4.2
Introduction and Problem
600.463 Introduction to Algorithms / Algorithms I
Topic: Asymptotic Analysis, recurrences
2.1
Lecturer: Zeyu Zhang
Date: 9/6/16
Notes
Homework 1 will be released today, and is due a week from today by the beginning of class.
Submit online via Gradescope.
600.463 Introduction to Algorithms / Algorithms I
Topic: Minimum Spanning Trees
15.1
Lecturer: Michael Dinitz
Date: 10/27/16
Introduction
Today were talking about Minimum Spanning Trees (MSTs). For this problem we are given an
undirected, connected graph
600.463 Introduction to Algorithms / Algorithms I
Homework #7
Fall 2016
Due: November 1, 2016, 1:30pm
Remember: you may work in groups of up to three people, but must write up your solution entirely
on your own. Collaboration is limited to discussing the
600.463 Introduction to Algorithms / Algorithms I
Homework #5
Fall 2016
Due: October 11, 2016, 1:30pm
Remember: you may work in groups of up to three people, but must write up your solution entirely
on your own. Collaboration is limited to discussing the
600.363/463 Algorithms - Fall 2013
Solution to Assignment 1
(110 points)
I (30 points) Tow possible solutions are shown below.
Solution 1:
i. Algorithm(10 points)
Input: Two arrays A and B, both of length n
Output: True if A and B have at least one common
600.363/463 Algorithms - Fall 2013
Solution to Assignment 2
(90 points+20 bonus points)
I (30 points)
1 a = 25, b = 5, logb a = log5 25 = 2. Since f (n) = n2.1 = n2+0.1 = (n2+0.1 ), by the master
theorem part 3, T (n) = (n2.1 )
2 a = 25, b = 5, logb a = l
600.363/463 Algorithms - Fall 2013
Solution to Assignment 3
(120 points)
I (30 points)
(Hint: This problem is similar to parenthesization in matrix-chain multiplication, except the
special treatment on the two possible operators.)
The optimal substructure
600.363/463 Algorithms - Fall 2013
Solution to Assignment 4
(30+20 points)
I (10 points)
This problem brings in an extra constraint on the optimal binary search tree - for every node
v , the number of nodes in both of its subtrees should be at least 1/5 o
600.363/463 Algorithms - Fall 2013
Solution to Assignment 5
(20 points)
I (10 points)
Note that the optimal substructure of LCS holds. We introduce another variable to record
the ending symbol of the common subsequence. Let c[i, j, a] be the length of the
600.363/463 Algorithms - Fall 2013
Solution to Assignment 6
(30 points)
I (10 points) 21-1 O-line minimum
a The values in the extracted array are 4, 3, 2, 6, 8, 1.
b Note that each key is inserted only once. Since the loop starts from the smallest value o
600.363/463 Algorithms
Mid Semester Examination 1
October 11, 2013
1 hr 10 mins; closed book
I. Specify whether the following equations hold or not. Give an intuitive juscation for your
answer. Formal proofs are not needed.
1. 3n2 + 5n = O(n2 log n)
2. 2n
600.363/463 Algorithms
Mid Semester Examination 2
November 11, 2013
1 hr 10 mins; closed book
I. Specify whether the following equations hold or not. Give an intuitive justication for your
answer. Formal proofs are not needed.
1
1. n3 + 10n2 = O( 100 n3 +