NPRG062 Introduction to Algorithms (winter 2022-3)

Instructors:

This course is a fast-paced introduction to fundamental algorithms, algorithmic complexity, and data structures.

Lectures and other meetings

Requirements

This course includes both a pass/fail credit and a graded final exam.

To receive the credit, you must fulfill the following requirements by Friday, February 12, 2023 at the end of the exam period:

You must complete the credit before you can enroll for the exam.

Textbooks

The Miller text is available online (see the link above). There are many copies of the Cormen text in the MFF library on the first floor.

Syllabus

This is a rough map of the ground we plan to cover in this class. (It will probably evolve as the semester goes on.)

October 4 (notes) (exercises)
Powers of two and ten. Logarithms. Divisibility. Quotient and remainder. Decimal representation. Numbers in different bases.
October 11 (notes) (exercises)
Converting between bases. Prime numbers. Primality testing using trial division. The fundamental theorem of arithmetic. Prime factorization. Limits.
October 18 (notes) (exercises)
Big-O notation. Analyzing a program's running time. Worst-case and best-case analysis. Greatest common divisor. Euclid's algorithm. Least common multiple.
October 25 (notes) (exercises)
The sieve of Eratosthenes. Sequential search in an array. Binary search for values. Binary search for a boundary.
November 1 (notes) (exercises)
Running time of list operations. Bubble sort, selection sort, insertion sort. Merging sorted arrays. Mergesort.
November 8 (notes) (exercises)
Running time of recursive functions. Quicksort.
November 15 (notes) (exercises)
Abstract data types. Stacks. Queues. Linked lists. Sets. Introduction to binary trees.
November 22 (notes) (exercises)
Binary search trees. Balanced and imbalanced trees. Dictionaries (maps).
November 29 (notes) (exercises)
Dynamic arrays. Hash functions. Hash tables.
December 6 (notes) (exercises)
Priority queues. Binary heaps. Heapsort. Lower bounds for sorting.
December 13 (notes) (exercises)
Graph representations. Depth-first search. Breadth-first search. Searching in state spaces.
December 20 (notes) (exercises)
Shortest paths in a graph. Infix, prefix and postfix notations. Expression trees. Parsing and evaluating arithmetic expressions.
December 27
No lecture (winter vacation).
January 3 (notes) (exercises)
Sorting in linear time. Counting sort. Radix sort.