CS 170 Fall 2009
1. (10 pts.) RSA Problem 1.42 Solution
Algorithms Christos Papadimitriou
HW 2 Solutions
We know that p is a prime and gcd(e, p - 1) = 1. Using the extended Euclidean algorithm find integers x, y such that xe + y(p - 1) = 1. We then have t
CIS 502 - Spring 2004 (5/3/04)
1
Solutions to Final Exam
May 3, 2004
Problem 1. You are given an unsorted array A of n positive integers (may not be distinct).
Design an O(n) time algorithm to nd the smallest positive integer that does not occur in the ar
CIS 502 - Spring 2005
Final and WPE Exam: 5/03/05
1. (20 points) (a) Prove that if there is a fully polynomial-time approximation scheme for vertex cover, then P = NP. Answer: In a n vertex graph, the size of a minimum vertex cover is between 0 and n. If
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2007
Midterm Examination
Instructor: Ladan Tahvildari Date: Monday, June 11, 2007, 6:30 p.m. Duration: 1.5 hours Type: Closed Book
Instru
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2004
Midterm Examination
Instructor: Ladan Tahvildari Date: Monday, June 21, 2004, 7:00 p.m. Duration: 2 hours Type: Closed Book
Instruct
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2005
Midterm Examination
Instructor: Ladan Tahvildari Date: Monday, June 13, 2005, 4:30 p.m. Duration: 2 hours Type: Closed Book
Instruct
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2006
Final Examination
Instructor: Ladan Tahvildari Date: Tuesday, August 1, 2006 Time: 4:00 p.m. to 6:30 p.m. Duration: 2.5 hours Type:
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2009
Midterm Examination
Instructor: Ladan Tahvildari, PhD, PEng Date: Tuesday, June 23, 2009, 5:30 p.m. Location: DWE 3518 Duration: 2 h
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2005
Final Examination
Instructor: Ladan Tahvildari Date: August 4, 2005 Time: 4:00 p.m. to 6:30 p.m. Duration: 2.5 hours Type: Closed Bo
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2006
Midterm Examination
Instructor: Ladan Tahvildari Date: Monday, June 12, 2006, 4:30 p.m. Duration: 1.5 hours Type: Closed Book
Instru
Analysis of Algorithms - Midterm (Solutions)
K. Subramani LCSEE, West Virginia University, Morgantown, WV cfw_ksmani@csee.wvu.edu
1
Problems
1. Recurrences: Solve the following recurrences exactly or asymototically. You may assume any convenient form for
Chapter 4 Divide-and-Conquer
1
About this lecture (1)
Recall the divide-and-conquer paradigm, which
we used for merge sort:
Divide the problem into a number of subproblems
that are smaller instances of the same problem.
Conquer the subproblems by solvi
Chapter 15-1 : Dynamic
Programming I
About this lecture
Divide-and-conquer strategy allows us to
solve a big problem by handling only
smaller sub-problems
Some problems may be solved using a
stronger strategy: dynamic programming
We will see some examp
Chapter82:SortinginLinear
Time
About this lecture
Sortingalgorithmswestudiedsofar
Insertion,Selection,Merge,Quicksort
determinesortedorderbycomparison
Wewilllookat3newsortingalgorithms
CountingSort,RadixSort,BucketSort
assumesomepropertiesontheinput
The Role of Algorithms in
Computing
What will we study?
Look at some classical algorithms on different
kinds of problems
How to design an algorithm
How to show that an algorithm works correctly
How to analyze the performance of an
algorithm
1.1 Algori
Chapter 6 Heapsort
1
About this lecture
Introduce Heap
Shape Property and Heap Property
Heap Operations
Heapsort: Use Heap to Sort
Fixing heap property for all nodes
Use Array to represent Heap
Introduce Priority Queue
2
Heap
A heap (or binary heap) is
Chapter 15: Dynamic
Programming II
Matrix Multiplication
Let A be a matrix of dimension p x q
and B be a matrix of dimension q x r
Then, if we multiply matrices A and B,
we obtain a resulting matrix C = AB
whose dimension is p x r
We can obtain each en
University of Waterloo Department of Electrical and Computer Engineering SE 240 Algorithms and Data Structures Spring 2004
Final Examination
Instructor: Ladan Tahvildari Date: Monday, August 9, 2004, 9:00 a.m. to 12:00 noon. Duration: 3 hours Type: Specia
CS 170 Fall 2009
Algorithms Christos Papadimitriou
HW 1
Due September 4th, 7pm
Instructions: Please write your name, your TAs name, your discussion section time (e.g., Fri 11am) prominently on the rst page of your homework. Also list your study partners f
15-451
Rec. 2
1
15-451: Algorithms
Recitation 4: Amortized Analysis
1
Bits and Trits
Suppose we have a binary counter such that the cost to increment the counter is equal to the number of bits that need to be ipped. We saw in class that if the counter beg
m tex!vCe5yc 9 rt cdtce5tY m t e y Y yY fYe 6a6a6 t Hc ct Y texThC m m le Da m le m le cWWYe@ty#m@mheaw m @ta m m m m @a Da teDxDa t 6YQ m m hr a m m m9w m m m ym y y p z ce5tY6 h ph m cfw_ cfw_ p Hh tv|c| mrm@m h m m swqrYrpvucxyy5ytqvyz5~vyDtv|lyzCxwvut
Midterm Exam-Solution Introduction to Algorithms, spring 2009 1. [10 points]Use a recursion tree to determine an asymptotically tight bound to the recurrence T(n) = T(n/3) + T(2n/3) + O(n). Use the substitution method to verify your answer.
2. [15 points]
FUNDAMENTAL ALGORITHMS MIDTERM SOLUTIONS
You must omit at least 10 points. Mark on your booklet which part or parts of problems you are omitting. Maximum score: 140. What is slight can still be great, if it is written in a natural, owing and easy style -
CS180 Algorithms Midterm Examination
Student ID: First name: Middle name: Last name:
These are not complete solutions but only the major ideas behind solutions.
1
Problem 1. [15%] Solve the following recurrences. You should only give the solutions in -not
Introduction to Algorithms Massachusetts Institute of Technology Professors Erik Demaine and Sha Goldwasser
November 27, 2002 6.046J/18.410J Handout 25
Problem Set
This is a make-up problem set, only for students who are missing several problems. It is du
Introduction to Algorithms Massachusetts Institute of Technology Professors Erik Demaine and Sha Goldwasser
December 2, 2002 6.046J/18.410J Handout 28
Problem Set
Solutions
Problem
-1. Optimal scheduling
(a) For (1) the schedule in which task 1 runs rst,
Introduction to Algorithms Massachusetts Institute of Technology Singapore-MIT Alliance Professors Erik Demaine, Lee Wee Sun, and Charles E. Leiserson
October 17, 2001 6.046J/18.410J SMA5503 Quiz 1 Solution
Quiz 1 Solution
Figure 1: grade distribution
Pro
Introduction to Algorithms Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser
October 7, 2002 6.046J/18.410J Quiz 1
Quiz 1
Do not open this quiz booklet until you are directed to do so. Read all the instructions first. Fo
Introduction to Algorithms Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser
November 18, 2002 6.046J/18.410J Quiz 2
Quiz 2
Do not open this quiz booklet until you are directed to do so. Read all the instructions first.