EECS4101
Solutions to Assignment 1
Winter 2016
1 (33%) Slide 1, Exercise 8: Discovering Pearly Boxes with Magic Wands:
Below we offer two solutions with number of wand touches about 2 n for the first solution, and somewhat
improved to
2 n for the second

Thinking about Algorithms Abstractly
Relevant Mathematics
Logic Quantifiers
The Time Complexity of an Algorithm
Classifying Functions
Adding Made Easy
Recurrence Relations
In More Details
Jeff Edmonds
Lecture skipped.
(Done when needed) York University
CO

Thinking about Algorithms Abstractly
Lower Bounds
& Models of Computation
Jeff Edmonds
York University
Lecture
COSC 3101
Lower Bounds for Sorting using
Information Theory
The Time Complexity of a Problem P
Merge, Quick, and Heap Sort can sort N numbers
us

EECS 3101
Prof. Andy Mirzaian
Summations
&
Recurrence Relations
STUDY MATERIAL:
[CLRS]
Appendix A, chapter 4
Lecture Note 3
2
Summations:
Recurrence Relations:
3
TOPICS
Summations & Recurrence Relations
arise in the running time analysis of algorithms

CSE 3101 Design and Analysis of Algorithms
Meta Steps for Unit 0
Je Edmonds
This contains the most important concepts in this unit. You will not be able to pass this course without
knowing and understanding these. The steps provided must be followed on al

CSE 3101 Design and Analysis of Algorithms
Meta Steps for Unit 1
Je Edmonds
This contains the most important concepts in this unit. You will not be able to pass this course without
knowing and understanding these. The steps provided must be followed on al

CSE 3101 Design and Analysis of Algorithms
Meta Steps for Unit 4
Je Edmonds
This contains the most important concepts in this unit. You will not be able to pass this course without
knowing and understanding these. The steps provided must be followed on al

CSE 3101 Design and Analysis of Algorithms
Meta Steps for Unit 5
Je Edmonds
This contains the most important concepts in this unit. You will not be able to pass this course without
knowing and understanding these. The steps provided must be followed on al

York University
CSE 3101
October 29, 2008
Homework Assignment #7
Due: November 7, 3:30 p.m.
1. Tiidrek is buying candy to give to children on Halloween. He has n dollars to spend. In the
store there are k types of candy packs. The ith type of pack contain

York University
CSE 3101
September 19, 2007
Homework Assignment #2
Due: September 29, 3:30 p.m.
1. Consider the following recursive algorithm:
F(n)
Precondition: n is a positive integer
if n = 1 then return 1
else if n = 2 then return 3
else return F ( n

Thinking about Algorithms Abstractly
Searching in a Graph
Generic Search
Breadth First Search
Dijkstra's Shortest Paths Algorithm
Depth First Search
Linear Order
Lecture 5
Jeff Edmonds
York University
COSC 3101
1
Graph
a
b Node ~ city or computer
Edge ~ r

Key to Many Courses
First Order Logic
Predicates, Forall, & Exists
vs
The Proof Game
Negations
Integers
Classifying Functions
Computable & Uncomputable
Time Complexity
Church's Thesis
Lecture
Jeff Edmonds
York University
Many Courses
Understand Quantifi

Thinking about Algorithms Abstractly
Reductions &
NP-Completeness
See 2001 slides
More Classes for 4111
More Detailed Steps for 6111
Jeff Edmonds
York University
Thanks
Intro & COSC 3101/4111/6111
Thinking about Algorithms Abstractly
Reductions &
NP-Co

Thinking about Algorithms Abstractly
Greedy Algorithms
Greedy Algorithm for Optimization Problems
Proving with Loop Invariants
Three Players making Change
Event Scheduling
Review and Don'ts
Minimum Spanning Tree
Adaptive Greedy
Interval Point Cover
Commun

Iterative Algorithms
& Loop Invariants
Lecture 1
Jeff Edmonds
York University
Understanding Algorithms Abstractly
Home to School Problem
Steps in an Iterative Algorithm
Assertions
The Sum of Objects
Insertion Sort
Selection Sort
Don't Redo Work
Designing

Thinking about Algorithms Abstractly
Recursive Back Tracking
&
Dynamic Programming
Jeff Edmonds York University
Lecture 7
COSC 3101
1
Techniques
Optimization Problems
A Sequence of Decisions
The Little Bird & Friend
Optimal Substructure
Memoization
Set of

Thinking about Algorithms Abstractly
Review
Jeff Edmonds
York University
COSC 3101
1
Some Math
Time Complexity
t(n) = (n2)
Logs and Exps
2a 2b = 2a+b
2log n = n
Classifying Functions
f(i) = n(n)
Tim
e
Logic Quantifiers
g b Loves(b,g)
b g Loves(b,g)
Input

CSE 3101 Design and Analysis of Algorithms
Assignment for Unit 3
Unmarked (A subset of the questions in the book)
Je Edmonds
Read the book. Learn the steps. Go to class. Ask lots of question. Study the slides. Work hard on solving
these questions on your

CSE 3101 Design and Analysis of Algorithms
Assignment for Unit 5
Unmarked (A subset of the questions in the book)
Je Edmonds
Read the book. Learn the steps. Go to class. Ask lots of question. Study the slides. Work hard on solving
these questions on your

CSE 3101 Design and Analysis of Algorithms
Assignment for Unit 4
Unmarked (A subset of the questions in the book)
Je Edmonds
Read the book. Learn the steps. Go to class. Ask lots of question. Study the slides. Work hard on solving
these questions on your

CSE 3101 Design and Analysis of Algorithms
Assignment for Unit 6
Unmarked (A subset of the questions in the book)
Je Edmonds
Read the book. Learn the steps. Go to class. Ask lots of question. Study the slides. Work hard on solving
these questions on your

CSE 3101 Design and Analysis of Algorithms
Review Test for Unit 1
(Required, checked for completion, but not read or marked.)
Je Edmonds
The goal of this exercises is to be guided through using the steps. It can either be done during a TA session
or on yo

York University
CSE 3101
September 12, 2007
Homework Assignment #1
Due: September 19, 3:30 p.m.
Along with your solutions to this assignment, hand in a separate sheet of paper
containing your student number and the following declaration: I have read and
u

York University
CSE 3101
September 26, 2008
Homework Assignment #3
Due: October 6, 3:30 p.m.
Recall that the recursive algorithm for fast multiplication from class. Its worst-case
running time on n-bit input numbers can be described by:
T (1)
T (2)
T (3)

York University
CSE 3101
October 15, 2008
Homework Assignment #5
Due: October 22, 3:30 p.m.
1. Suppose you are given n points described by Cartesian coordinates (x1 , y1 ), (x2 , y3 ), . . . , (xn , yn ).
All the coordinates are integers between n and n.