MIT OpenCourseWare http:/ocw.mit.edu
6.006 Introduction to Algorithms
Spring 2008
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
Introduction to Algorithms: 6.006 Massachusetts Institute of Technology Pro
String algorithms
6.046 Introduction to Algorithms Spring 05
Today: String matching I
The exact string matching problem
Nave algorithm
Preprocessing the query:
String algorithms I & II
Prof. Manolis Kellis
Fundamental pre-processing
Knuth-Morris-Pratt
Not Found
The requested URL /6.046/fall06/ps7/solution.html was not found on this server.
Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 mod_jk/1.2.26 mod_ssl/2.2.9 OpenSSL/0.9.8o Server at
courses.csail.mit.edu Port 80
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
November 6, 2006
6.046J/18.410J
Problem Set 7
Problem Set 7
This problem set is due in lecture on Monday, November 13, 2006. The homework
lab for this
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
November 6, 2006
6.046J/18.410J
Problem Set 6 Solutions
Problem Set 6 Solutions
Problem 6-1. Corporate Chaos
You are a qualitative analyst for a nanci
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 30, 2006
6.046J/18.410J
Problem Set 6
Problem Set 6
This problem set is due in lecture on Monday, November 6, 2005. The homework
lab for this
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 30, 2006
6.046J/18.410J
Problem Set 5 Solutions
Problem Set 5 Solutions
Problem 5-1. The Inconvenient Defense
You are a Ph.D. student trying t
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 23, 2006
6.046J/18.410J
Problem Set 5
Problem Set 5
This problem set is due in lecture on Monday, October 30, 2006. The homework
lab for this
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 23, 2006
6.046J/18.410J
Problem Set 4 Solutions
Problem Set 4 Solutions
Problem 4-1. AVL Trees. An AVL tree is a binary search tree that is he
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 16, 2006
6.046J/18.410J
Problem Set 4
Problem Set 4
This problem set is due in lecture on Monday, October 23, 2006. The homework
lab for this
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 6, 2006
6.046J/18.410J
Problem Set 3 Solutions
Problem Set 3 Solutions
Problem 3-1. Popular Elements
Given an array A[1 . . n] of n elements,
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
November 13, 2006
6.046J/18.410J
Problem Set 7 Solutions
Problem Set 7 Solutions
Problem 7-1. Typesetting
In this problem you will write a program (re
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
November 13, 2006
6.046J/18.410J
Problem Set 8
Problem Set 8
This problem set is due in lecture on Monday, November 20, 2006. The homework
lab for thi
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Charles E. Leiserson and Ronald L. Rivest
May 10, 2005
6.046J/18.410J
Practice Final ExamFrom Fall 2004
Practice Final ExamFrom Fall 2004
Problem 1. Recurrences (4 parts) [8 point
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Charles E. Leiserson and Ronald L. Rivest
May 10, 2005
6.046J/18.410J
Practice Final ExamFrom Fall 2004
Practice Final ExamFrom Fall 2004
Problem 1. Recurrences (4 parts) [8 point
Introduction to Algorithms, Lecture 5
Feburary 16, 2005
Today
Introduction to Algorithms
Order statistics (e.g., finding median)
Two O(n) time algorithms:
6.046J/18.401J
Randomized: similar to Quicksort
Deterministic: quite tricky
Both are examples o
6.046 Introduction to Algorithms, Lecture 4
February 14, 2005
Today
Introduction to Algorithms
6.046J/18.401J
Randomized algorithms: algorithms that flip coins
Matrix product checker: is AB=C ?
Quicksort:
Example of divide and conquer
Fast and practi
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
November 20, 2006
6.046J/18.410J
Problem Set 8 Solutions
Problem Set 8 Solutions
Problem 8-1. Shortest paths in graphs with alternative distance measu
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
Quiz 2 Solutions
December 8, 2006
6.046J/18.410J
Handout 7
Handout 7: Quiz 2 Solutions
2
Problem 1. Big Bully
The year is 2048. The world has been tak
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
October 11, 2006
6.046J/18.410J
Handout 5
Quiz 1 Solutions
Quiz 1 Statistics
Median
53
Mean
51.7
Std. Deviation 16.0
Max
79
Problem Parts Points Grade
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
December 8, 2006
6.046J/18.410J
Problem Set 9 Solutions
Problem Set 9 Solutions
Problem 9-1. Subgraph Isomorphism
Two graphs G1 = (V1 , E1 ) and G2 =
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
December 4, 2006
6.046J/18.410J
Problem Set 9
Problem Set 9
This problem set is due in recitation on Friday, December 8, 2006. The homework
lab for th
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
September 27, 2006
6.046J/18.410J
Problem Set 3
Problem Set 3
This problem set is due in recitation on Friday, October 6, 2006 The homework lab
will b
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
September 27, 2006
6.046J/18.410J
Problem Set 2 Solutions
Problem Set 2 Solutions
Problem 2-1. Sorting can be boring!
A comparison sort is boring if,
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Madhu Sudan
September 18, 2006
6.046J/18.410J
Problem Set 2
Problem Set 2
This problem set is due in lecture on Wednesday, September 27, 2006. The homework lab wi
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Piotr Indyk and Charles E. Leiserson
November 15, 2004
6.046J/18.410J
Handout 26
Problem Set 6 Solutions
Reading: Chapters 22, 24, and 25.
Both exercises and problems should be so
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Piotr Indyk and Charles E. Leiserson
Octoberber 31, 2004
6.046J/18.410J
Handout 21
Problem Set 5 Solutions
Reading: Chapters 15, 16
Both exercises and problems should be solved, b
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Piotr Indyk and Charles E. Leiserson
October 24, 2004
6.046J/18.410J
Handout 18
Problem Set 4 Solutions
Reading: Chapters 17, 21.121.3
Both exercises and problems should be solved
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Piotr Indyk and Charles E. Leiserson
October 22, 2004
6.046J/18.410J
Handout 9
Problem Set 3 Solutions
Reading: Chapters 12.1-12.4, 13, 18.1-18.3
Both exercises and problems shoul
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Piotr Indyk and Charles E. Leiserson
October 1, 2004
6.046J/18.410J
Handout 9
Problem Set 2 Solutions
Reading: Chapters 5-9, excluding 5.4 and 8.4
Both exercises and problems shou