CS 466/666 Spring 2014
Assignment 4
Due Noon, June 9, 2014
You are on your honour to present your own work and acknowledge your sources.
1. [14 marks] This question deals with an algorithm to find the second largest of n values.
In class we mentioned/prov
University of Waterloo
CS466/666 Spring 2016
Assignment 11
Due Date: Tues, July 26, at 5:00pm - NO LATES ACCEPTED
Please present your own work. ACKNOWLEDGE YOUR SOURCES.
Problem 1
[10 marks]
Consider the following rather stupid caching algorithm. Suppose
University of Waterloo
CS466/666 Spring 2016
Assignment 5
Due Date: Wednesday, June 8, at 5:00pm
DO NOT COPY. ACKNOWLEGE YOUR SOURCES.
Problem 1
[10 marks]
Give an algorithm to find a random t-bit prime. Use the Miller-Rabin primality test from
class, whi
University of Waterloo
CS466/666 Spring 2016
Assignment 3
Due Date: Wednesday, May 25, at 5:00pm
DO NOT COPY. ACKNOWLEGE YOUR SOURCES.
Problem 1
[5 marks]
Describe a data structure to perform the following operations on an array A[1 . . . n] as
efficientl
University of Waterloo
CS466/666 Spring 2016
Assignment 6
Due Date: Friday, June 17, at 5:00pm
Please present your own work. ACKNOWLEGE YOUR SOURCES.
Problem 1
[10 marks]
This question is about the expected number of comparisons made by randomized quickso
Your name
Your student number
CS 466/666: ALGORITHM DESIGN AND ANALYSIS
PROBLEM SET 2
DUE ON: OCTOBER 13, 2016
Acknowledgements.
Acknowledge all collaborators with whom you discussed any of the problems in this problem
set and all external sources that yo
Your name
Your student number
CS 466/666: ALGORITHM DESIGN AND ANALYSIS
PROBLEM SET 3
DUE ON: NOVEMBER 3, 2016
Acknowledgements.
Acknowledge all collaborators with whom you discussed any of the problems in this problem
set and all external sources that yo
Your name
Your student number
CS 466/666: ALGORITHM DESIGN AND ANALYSIS
PROBLEM SET 1 (V.2)
DUE ON: SEPTEMBER 29, 2016
Acknowledgements.
Acknowledge all collaborators with whom you discussed any of the problems in this problem
set and all external sources
Your name
Your student number
CS 466/666: ALGORITHM DESIGN AND ANALYSIS
PROBLEM SET 5
DUE ON: DECEMBER 1, 2016
Acknowledgements.
Acknowledge all collaborators with whom you discussed any of the problems in this problem
set and all external sources that yo
Your name
Your student number
CS 466/666: ALGORITHM DESIGN AND ANALYSIS
PROBLEM SET 4
DUE ON: NOVEMBER 17, 2016
Acknowledgements.
Acknowledge all collaborators with whom you discussed any of the problems in this problem
set and all external sources that y
Assignment 2.
Post date: Sept. 23, 2014.
Due date: Sept. 29, 2014 (Monday) by noon time. The answers need to be typed up with a
computer. Hand in printed paper at assignment box at 4th floor of MC across from the tutorial
centre.
Question 1. (10 marks)
In
Assignment 4.
Post date: Oct. 13, 2014.
Due date: Oct. 20, 2014 (Monday) by noon. Hand in printed paper at assignment box at 4th floor
of MC across from the tutorial centre.
Marking TA: Chuan Guo
Mandatory requirement for assignment being accepted:
The an
Assignment 5.
Post date: Nov. 4, 2014.
Due date: Nov. 10, 2014 (Monday) by noon. Hand in printed paper at assignment box at 4th
floor of MC across from the tutorial centre.
Marking TA: Chen Fei Du
Mandatory requirement for assignment being accepted:
The a
Assignment 7.
Post date: Nov. 20, 2014.
Due date: Nov. 28, 2014 (Friday) by noon. Hand in printed paper at assignment box at 4th floor
of MC across from the tutorial centre.
Marking will be done by Prof. Ma.
Mandatory requirement for assignment being acce
Assignment 3.
Post date: Oct. 2, 2014. Corrections (red fonts) on Oct. 9, 2014.
Due date: Oct. 14, 2014 (Tuesday) by noon. Hand in printed paper at assignment box at 4th floor
of MC across from the tutorial centre.
Meeting submission requirement: (5 marks
University of Waterloo
CS466/666 Spring 2016
Assignment 2
Due Date: Wednesday, May 18, at 5:00pm
DO NOT COPY. ACKNOWLEGE YOUR SOURCES.
Problem 1
[5 marks]
Assuming that keys can be accessed ONLY by means of pair-wise comparisons, prove that
for any implem
University of Waterloo
CS466/666 Spring 2016
Assignment 9
Due Date: Wed, July 13, at 5:00pm
Please present your own work. ACKNOWLEDGE YOUR SOURCES.
Problem 1
[10 marks]
Consider the following optimization version of the Partition problem. Given a set X of
CS 466/666 Spring 2014
Assignment 1
Due Noon, Tuesday May 20, 2014
Acknowledge your sources; do not copy
1. [6 marks] Extending the Master Theorem: Suppose we have a simple recursive algorithm that to
solve a problem of size n we recursively solve two pro
CS 466/666
The Complexity of Comparison Based Problems
Lectures: July 11 - 25
Suppose we have a set of n (distinct) values and are to find the ith largest, or the elements
of several ranks. Our model of computation will be that of simple comparisons betwe
CS 466/666 Spring 2014
Assignment 2
Due Noon, Monday May 26, 2014
1. [8 marks] Suppose you have the elements 1, ,10 stored in that order in a list.
(a) How many elements inspections occur in performing the following sequence of
searches: 3, 10, 3, 4, 5, 3
CS 466/666 Spring 2014
Assignment 3
Due Noon, June 2, 2013
You are on your honour to present your own work and acknowledge your sources.
1. [6 marks: Splay Trees] One feature of splaying versus the simple move to root heuristic
is that in performing a spl
CS 466/666 Spring 2014
Assignment 5
Due Noon, June 16, 2014
You are on your honour to present your own work and acknowledge your sources.
1. [14 marks] Consider Mergesort when n is not (necessarily) a power of 2. The method works
by (recursively) sorting
CS 466/666
Instructor: Ian Munro DC2343 imunro@.
(Office hours: after class)
TAs:
Vinayak Pathak; DC3132, vpathak@.
Yizhe Zeng; DC2555A, y29zeng@.
(Office hours to be announced)
For most information, see course page
https:/www.student.cs.uwaterloo.ca/~cs4
Amortized Analysis:
Linear Lists & Search Trees
Binary search trees: worst case (lg n)
Linear lists: worst case (n)
Stochastic model (probs pi): Static optimal
(SOpt = H and ipi resp (expected cost)
Worst case for a sequence of requests:
amortized cost =
Range Searching
Data structure for a set of objects (points, rectangles, polygons) for ecient range queries.
Y
Q
X
Depends on type of objects and queries. Consider basic data structures with broad applicability. Time-Space tradeo: the more we preprocess
Partitions with Union-Find
Operations ( 12.7)
Union-Find Partition Structures
2004 Goodrich, Tamassia
Union-Find
1
makeSet(x): Create a singleton set containing
the element x and return the position storing x
in this set.
union(A,B ): Return the set A U
University of Waterloo
CS466/666 Spring 2016
Assignment 8
Due Date: Wed, July 6, at 5:00pm
Please present your own work. ACKNOWLEDGE YOUR SOURCES.
Problem 1
[15 marks]
Consider the Travelling Salesman Problem on a graph with metric edge weights (i.e. the
University of Waterloo
CS466/666 Spring 2016
Assignment 10
Due Date: Wed, July 20, at 5:00pm
Please present your own work. Do not copy from classmates.
Problem 1
[20 marks]
Consider the following problem: You have a set of strings T = cfw_s1 , . . . , sn
University of Waterloo
CS466/666 Spring 2016
Assignment 4
Due Date: Wednesday, June 1, at 5:00pm
Present your own work and acknowledge your sources.
Problem 1
[5 marks]
Recall that range trees allowed us to answer queries for the set of points in a given
University of Waterloo
CS466/666 Spring 2016
Assignment 7
Due Date: Wed, June 29, at 5:00pm
Please present your own work. ACKNOWLEDGE YOUR SOURCES.
Problem 1
[5 marks]
Prove that if there is a polynomial time approximation algorithm for Independent Set th