Illinois Institute of Technology Department of Computer Science
Solutions to First Examination
CS 430 Introduction to Algorithms Fall, 2007
10am11:15am, Wednesday, September 26, 2007 121 Life Sciences 1. (a) n2 (2n)2 = 4n2 so the algorithm takes 4
Illinois Institute of Technology
Department of Computer Science
Course Information
CS 430 Introduction to Algorithms
Spring Semester, 2016
Staff
Professor: Edward M. Reingold ([email protected])
Office: 228F, Stuart Building
Office Hours: Immediately after
Illinois Institute of Technology Department of Computer Science
Lecture 6: February 9, 2009
CS 430 Introduction to Algorithms Spring Semester, 2009
1
Lower Bounds on Sorting
All of the sorting algorithms that we have seen have been based on eleme
Illinois Institute of Technology Department of Computer Science
Solutions to Homework Assignment 1
CS 430 Introduction to Algorithms Spring Semester, 2009
1. Problem 2.3-3 on page 36 Solution: The base case is when n = 2, and we havenlgn = 2lg2 = 2
Illinois Institute of Technology
Department of Computer Science
Solutions to First Examination
CS 430 Introduction to Algorithms
Spring, 2012
11:25am12:40pm, Wednesday, February 8, 2012
104 Stuart Building
Exam Statistics
56 students took the exam. The ra
Illinois Institute of Technology
Department of Computer Science
Homework Assignment 1
CS 430 Introduction to Algorithms
Spring Semester, 2016
Rules for Homework
On this and all future homework assignments, observe these guidelines or credit will be deduct
Illinois Institute of Technology
Department of Computer Science
First Examination
CS 430 Introduction to Algorithms
Spring, 2012
11:25am12:40pm, Wednesday, February 8, 2012
104 Stuart Building
Print your name and student ID, neatly in the space provided b
Illinois Institute of Technology
Department of Computer Science
Solutions to First Examination
CS 430 Introduction to Algorithms
Spring, 2016
Monday, February 15, 2016
10am11:15am & 11:25am12:40pm, 111 Life Sciences
Exam Statistics
123 students took the e
Illinois Institute of Technology Department of Computer Science
Lecture 3: January 28, 2009
CS 430 Introduction to Algorithms Spring Semester, 2009
How to Sort A Sequence of Numbers
Dening the problem
Input: A sequence of n numbers a1 , a2 , , a
Illinois Institute of Technology
Department of Computer Science
Homework Assignment 7
CS 430 Introduction to Algorithms
Fall Semester, 2014
Due: Monday, November 17
1. Suppose you are given an 8-pint jug full of water and two empty jugs of 3- and 5-pint c
Illinois Institute of Technology Department of Computer Science
First Examination
CS 430 Introduction to Algorithms Fall, 2007
10am11:15am, Wednesday, September 26, 2007 121 Life Sciences
Print your name and student ID, neatly in the space provided
Illinois Institute of Technology Department of Computer Science
Solutions to First Examination
CS 430 Introduction to Algorithms Spring, 2009
11:25am12:40pm, Wednesday, February 23, 2009 104 Stuart Building 1. Randomized Min Consider the following a
Illinois Institute of Technology Department of Computer Science
Solutions to Homework Assignment 2
CS 430 Introduction to Algorithms Spring Semester, 2009
Due: Wednesday, February 11
1. Problem 6.4-3 on page 136 The problem is to get the running ti
Illinois Institute of Technology Department of Computer Science
First Examination
CS 430 Introduction to Algorithms Spring, 2009
11:25am12:40pm, Wednesday, February 23, 2009 104 Stuart Building
Print your name and student ID, neatly in the space pr
CS430 Lecture 6 Activities
Opening Questions
1. Explain the difference between the Binary Search Tree Parent-Child value relationship and the Heap
Property Parent-Child value relationship.
2. Binary search trees are a dynamic data structure that uses left
CS430 Lecture 1 Activities
Opening Questions
1. Algorithm A takes 5 seconds to sort 1000 records, and Algorithm B takes 10 seconds to sort 1000
records. You have the code for both algorithms. When deciding which algorithm to use to sort up to
1,000,000 re
CS430 Lecture 2 Activities
Opening Questions
1. How did we approach average case runtime analysis of iterative algorithms previously? How can we
improve on this?
Expectation of a Random Variable
A random variable is a variable that maps an outcome of a ra
CS430 Lecture 4 Activities
Opening Questions
1. Define Big-O, Omega and Theta notation.
2. In your own words explain what a recurrence relation is, what do we use recurrence relations for, why do
we solve recurrence relations?
Recurrence Relation Solution
CS 430 SUMMER 2017
INTRODUCTION TO ALGORITHMS
HOMEWORK #3
DUE BY 8:50AM ON TUESDAY 6/13/17
1. (5 points) Exercise 12.1-5 Argue that since sorting n elements takes (n lg n) time in the worst case in the comparison
model, any comparison-based algorithm for
CS430 Lecture 10 Activities
Opening Questions
1. What is the main problem with Binary Search Trees that Red-Black Trees correct? Explain briefly (2-3
sentences) how Red-Black Trees correct this problem with Binary Search Trees.
2. For the balanced binary
CS430 Lecture 14 Activities
Opening Questions
1. Why are optimal solutions to sub-problems stored in a table in dynamic programming solutions?
Constructing the answer for the Optimal Matrix Chain Multiplication (optimal parenthesization) from the
dynamic
CS430 Lecture 24 Activities
Shortest Path Problem
Variants
Single-source: Find shortest paths from a given source vertex s V to every vertex v V.
Single-destination: Find shortest paths to a given destination vertex.
Single-pair: Find shortest path fro
CS430 Lecture 13 Activities
Opening Questions
1. Briefly explain what two properties a problem must have so that a dynamic programming algorithm
approach will work.
2. Previously we have learned that divide-and-conquer algorithms partition a problem into
CS 430 SUMMER 2017
INTRODUCTION TO ALGORITHMS
HOMEWORK #1
DUE BY 8:50AM ON TUESDAY 5/30/17
1. (2 points) Use the divide-and-conquer approach to write a recursive algorithm that finds the largest item in a list of n
items. Analyze the runtime of your algor
CS 430 SUMMER 2017
INTRODUCTION TO ALGORITHMS
HOMEWORK #4 KEY
DUE BY 8:50AM ON THURSDAY 6/22/17
1. (3 points) Exercise 15.2-1 Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is
<5, 10, 3, 12, 5, 50, 6>. Find both th
CS 430 SUMMER 2017
INTRODUCTION TO ALGORITHMS
HOMEWORK #5
DUE BY 8:50AM ON THURSDAY 6/29/17
1. (2 points) Exercise 22.1-7 The incidence matrix of a directed graph G = (V, E) is a |V| |E| matrix B = (bij) such that
Describe what the entries of the matrix p
CS 430 SUMMER 2017
INTRODUCTION TO ALGORITHMS
HOMEWORK #2
DUE BY 8:50AM ON TUESDAY 6/6/17
1. (2 points) Exercise 7.2-3 Show in detail that the running time of sort in increasing order QUICKSORT is T(n^2) when
the array A contains distinct elements and is
CS430 Lecture 3 Activities
Opening Questions
1. What are the three steps in an inductive proof?
2. Describe an efficient divide and conquer algorithm to count the number of times a character appears in
a string of length n.
Asymptotic Analysis (more detai
Assignment 3
Quicksort is better than Merge Sort
1. Quick Sort is in-place sorting algorithm whereas merge sort is
not. In-place sorting can be defined in terms of memory usage
while sorting the elements. Quick sort does not use extra
additional space for
Section IV.5: Recurrence Relations from Algorithms
Given a recursive algorithm with input size n, we wish to find a (best big O)
estimate for its run time T(n) either by obtaining an explicit formula for T(n) or by
obtaining an upper or lower bound U(n) f
CS430 Lecture 26 Activities
All-Pairs Shortest Paths Problem
Given a directed graph G = (V, E), weight function w : E R, |V| = n.
Goal: create an n n matrix of shortest-path distances from every vertex to every other vertex (u,
v).
Could run BELLMAN-FO
CS430 Lecture 5 Activities
Opening Questions
1. Mergesort is ThetaO(n lg n) runtime in best case, worst case and average case. How much memory is
needed for Mergesort on input size n?
2. Mergesort does all the work of sorting items in the Merge function,
CS430 Lecture 16 Activities
Opening Questions
1. Briefly explain what two properties a problem must have so that a greedy algorithm approach will work.
2. A good cashier gives change using a greedy algorithm to minimize the number of coins they give back.
CS430 Lecture 9 Activities
Opening Questions
1. In your own words explain how you insert a new key in a binary search tree.
2. Give an example of a series of 5 keys inserted one at a time into a binary search tree that will yield a
tree of height 5.
3. If
CS430 Lecture 7 Activities
Opening Questions
1. If we have 17 distinct items to sort, what is the height of the decision tree that represents all possible
orderings of the 17 items?
Comparison Sorts
The sorted order they determine is based only on compari