COMP-251: Data structures and algorithms

Fall 2007



Tuesday and Thursday from 10:00am to 11:30am


ENGTR 0060 (Trottier building)



Prof. Patrick Hayden


108N McConnell



Office hours:

Wednesday from 8:30 to 10:30



Teaching assistants:

Nicolas Dutil (

††††††††††† Office hours: Monday 10:30-12:30 in McConnell 110

Weihuan Shu (

††††††††††† Office hours: Tuesday 2:30-4:30 in McConnell 102

Summary :

Design and analysis of algorithms. Complexity of algorithms. Data structures. Introduction to graph algorithms and their analysis. (3 credits)



~5 homework assignments:




Midterm exam:




Final exam:





Course web page:

Further materials, including a course discussion area, can be accessed through the Web CT Vista system:

Visit and log in using your McGill ID.


Topics and readings lecture by lecture:


Other resources:

The indispensable course wiki: 

Course page from fall 2006:


In case you havenít heard:

McGill University values academic integrity. Therefore all students must understand the meaning and consequences of cheating, plagiarism and other academic offences under the Code of Student Conduct and Disciplinary Procedures. (See for more information.)


Course textbooks:


Recommended: Algorithms

by Dasgupta, Papadimitriou and Vazirani



Required: Introduction to Algorithms, 2/e

by Cormen, Leiserson, Rivest and Stein



Available free online from McGill or using VPN. Free registration required.


Chapters whose contents you should already know:

Iíll be assuming you have already learned these topics, so if your memory is a bit hazy, you may wish to reread these chapters and try some of the exercises.

Chapter 1: The Role of Algorithms in Computing

Chapter 2: Getting Started

Chapter 3: Growth of Functions

Chapter 6: Heapsort

Chapter 10: Elementary Data Structures

Chapter 12: Binary Search Trees

Chapter 22: Elementary Graph Algorithms


Course content:

Data structures:

††††††††††††††††††††††† Hash tables

††††††††††††††††††††††† Balanced search trees (red black trees, B-trees)

††††††††††††††††††††††† Mergeable heaps (binomial heaps, Fibonacci heaps)

††††††††††††††††††††††† Data structures for disjoint sets

Algorithm analysis and design:

††††††††††††††††††††††† Analysis techniques:

††††††††††††††††††††††††††††††††††† Solving recurrences (a refresher)

††††††††††††††††††††††††††††††††††† Proving correctness using loop invariants

††††††††††††††††††††††††††††††††††† Probabilistic analysis

††††††††††††††††††††††††††††††††††† Amortized analysis

††††††††††††††††††††††† Design techniques:

††††††††††††††††††††††††††††††††††† Divide and conquer

††††††††††††††††††††††††††††††††††† Greedy algorithms

††††††††††††††††††††††††††††††††††† Dynamic programming

††††††††††††††††††††††† Sorting and related issues:

††††††††††††††††††††††††††††††††††† Analysis of quicksort

††††††††††††††††††††††††††††††††††† Lower bound for comparison sorting

††††††††††††††††††††††††††††††††††† Sorting in linear time

††††††††††††††††††††††††††††††††††† Medians and order statistics

††††††††††††††††††††††† Graph algorithms:

††††††††††††††††††††††††††††††††††† Applications of depth-first search

††††††††††††††††††††††††††††††††††† Minimum spanning trees

††††††††††††††††††††††††††††††††††† Shortest path problems

††††††††††††††††††††††† Other examples and applications:

††††††††††††††††††††††††††††††††††† Fast Fourier Transform and polynomials

††††††††††††††††††††††††††††††††††† Matrix multiplication

††††††††††††††††††††††††††††††††††† Intersections of line segments

††††††††††††††††††††††††††††††††††† Closest pair of points

††††††††††††††††††††††††††††††††††† Approximation algorithm for the planar traveling salesman problem

††††††††††††††††††††††† Other topics, time-permitting:

††††††††††††††††††††††††††††††††††† Number theoretic algorithms

††††††††††††††††††††††††††††††††††† Intro to quantum algorithms