CS6033: Midterm Review
March 23, 2016
Midterm Exam Par;culars
Midterm will be open from Friday morning un;l Monday night.
You can choose any (reasonable) 150 minute slot in this window.
You have to make an appointment with ProctorU for your desire

Hash Tables Cont.
maintain a dynamic set
Suppose
you are asked to store a dynamic set of 300 IP
(Internet protocol) addresses for the set of active
customers of a Web service. (IP address are 32
bits that encode the location of a computer on the
internet.

Lecture 3
SEARCH
INSERT
DELETE
MINIMUM
MAXIMUM
SUCCESSOR
PREDECESSOR
T.root
x
x
x
BST property
Self Balancing Trees
Balanced: height is O(log n)!
2-3 Trees
2-3-4 Trees
Red-Black Trees
Augmenting Data Types
a-b Trees
b-Trees - next lecture
Running time to

Preliminaries and Lecture 1
CS6033 Homework Assignment1
Due Jan. 31th at 5:30 p.m.
Turn in this assignment as a PDF file on NYU classes
No late assignments accepted
January 26, 2017
1. (5 points) Find two functions f (n) and g(n) such that f (n) o(g(n) an

Skip to content
This repository
Pull requests
Issues
Gist
New repository Import repository New gist New organization
This repository
New issue
Signed in as sjtuchris
Your profile Your stars Explore Integrations Help
Settings
Sign out
Watch 156
Notific

Lecture 5
B-trees
Recurrence Relations
Asymptotic closed form solution Recurrence Relations
Divide and Conquer Algorthms
EXTERNAL MEMORY
MODEL
Previously we used the RAM (random access machine)
model to estimate the run time
This model isnt a good estimat

Lecture 3
SEARCH
INSERT
DELETE
MINIMUM
MAXIMUM
SUCCESSOR
PREDECESSOR
T.root
x
x
x
BST property
Self Balancing Trees
Balanced: height is O(log n)!
2-3 Trees
2-3-4 Trees
Red-Black Trees
Augmenting Data Types
a-b Trees
b-Trees - next lecture
Running time to

CS6033 Homework Assignment 5
Due Feb 28th at 5:30 pm
No late assignments accepted
1. (10 points) Write the pseudo code for how to find the minimum key stored in a B-tree and how to find
the predecessor of a given key stored in a B-tree. Provide the CPU ru

Hash Tables Cont.
maintain a dynamic set
Suppose
you are asked to store a dynamic set of 300 IP
(Internet protocol) addresses for the set of active
customers of a Web service. (IP address are 32
bits that encode the location of a computer on the
internet.

Preliminaries and Lecture 1
CS6033 Homework Assignment1
Due Jan. 31th at 5:30 p.m.
Turn in this assignment as a PDF file on NYU classes
No late assignments accepted
January 26, 2017
1. (5 points) Find two functions f (n) and g(n) such that f (n) o(g(n) an

CS6033 HW8 Prof. Yu Chen
Problem 1
Theorem 23.1 shows this.
Let A be the empty set and S be any set containing u but not v.
Problem 2
Without loss of generality, lets assume that the edge E_x=(u,v) is the edge with the edge with
maximum weight. Consider t

CS6033 HW6 Solutions Prof.Yu Chen
Problem1:
(i)
(ii)
(iii)After delete elements: 40,12,3,74
In the following page, you will find the trees after each deletion. Current answer follows the rule
in the textbook. If you follow the rule in the video, 43 would

Solutions for CS6033 HW2
Problem (1)
h(n)=1+n+n2+n3+nr, where r>0 and is an integer. The following inequality holds:
nr 1+n+n2+n3+nr (1+r) nr
Therefore, by the definition of asymptotic big-O notation, this complexity of h(n) is
.
Alternatively, you can al

CS6033 HW9 Solutions
Prof. Yu Chen
Problem 1:
s as the source:
In every iteration, we relax a vertex and this is indicated by the bold edge that points to that
particular vertex. In subsequent iterations, the relaxed vertices are shown with bold lines. Th

CS6033 Prof. Yu Chen
Solutions to HW5
Problem 1:
(i) cfw_0, 10, 110, 111
/\
/ \
0
1
frequencies: cfw_8, 4, 2, 2
w
/\
0 1
x /\
01
yz
(ii) cfw_0, 10, 11, 001 In this case the coding is ambiguous. The string 0010 could be
interpreted as either the letter z f

CS6033 HW4 Solutions
Prof. Yu Chen
Problem 1:
(a) Step 1: Sort the array
(n log n)
Step 2: for i=1 to n/2 do
(n)
if A[i] equals A[i+(n/2)] return A[i]
return No popular number exists
The algorithm requires a comparison of n/2 pairs of items after sorting.

Home work 2 Solution
Problem 1
All the elements are equal: N^2 (unbalanced partitioning)
Problem 2:
!
Problem 3
Smallest possible depth of a leaf in a decision tree for a comparison sort:
n1; This is the minimal number of comparisons we need to perform in

Analysis(of(Algorithms
CS(477/677
Hashing
Thanks:(George(Bebis
(Chapter)11)
The(Search(Problem
Find(items(with(keys matching(a(given(search key
Given an array A, containing n keys, and a search key
x, find the index i such as x=A[i]
As in the case of s

Analysis of Algorithms
CS 6033
Hashing (Chapter 11) Contd
Thanks: Prof. George Bebis
Universal Hashing
In practice, keys are not randomly distributed
Any fixed hash function might yield (n) time
Goal: hash functions that produce random
table indices ir

Analysis of Algorithms
GRAPHS
Chapter 22
Thanks: George Bebis
But First!
Midterm postmortem
2
The Good
1. [10 PTS] An O(n^2) algorithm is always faster than a O(n^3) algorithm. Is this true or
false? Why?
2. [10 PTS] Give an example of a sorting problem

Analysis of Algorithms
CS 6033
Dynamic Programming
Thanks: George Bebis
(Chapter 15)
Final Exam
When: May 14, 2012, 6-8:30PM
Where: Online (Instructions will be forthcoming)
Let me immediately if you have a conflict or
cannot make it.
Reminder: HW 4 (

CS 6033 Design and Analysis of Algorithms I, Section INET
Spring 2016 Schedule
Important Dates:
Semester start: 1/25/2016
First Class: 1/27/2016
Selection of Project Topic and Team: 2/26/2016
Spring Recess: 3/14 3/20/2016
Mid-

Graphs
I
Graphs are one of the unifying themes of computer science.
I
That so many dierent structures can be modeled using a
single formalism is a source of great power to the educated
programmer.
I
A graph G = (V , E ) is defined by a set of vertices V ,

Analysis of Algorithms
Shortest Paths
Thanks: George Bebis
Chapter 24
Shortest Path Problems
How can we find the shortest route between two
points on a road map?
Model the problem as a graph problem:
Road map is a weighted graph:
vertices = cities
edge

CS6033: DESIGN AND ANALYSIS OF
ALGORITHMS 1
General Information
This class is listed in the catalog as:
CS-GY 6033 SECTION INET DESIGN AND ANALYSIS OF ALGORITHMS I
It is your responsibility to read all information in this "Syllabus and Polici

25 | P a g e
26 | P a g e
27 | P a g e
28 | P a g e
29 | P a g e
30 | P a g e
31 | P a g e
32 | P a g e
33 | P a g e
34 | P a g e
35 | P a g e
36 | P a g e
37 | P a g e
38 | P a g e
39 | P a g e
40 | P a g e
41 | P a g e
42 | P a g e

DAA -Fall 2016
Home Work 8
Due date: 12/04/2016
Problem 1
Show the results of inserting the keys
F, S, Q, K, C, L, H, T, V, W, M, R, N, P, A, B, X, Y, D, Z, E
in order into an empty B-tree with minimum degree 2. Draw only the configurations
of the tree ju

Dynamic Programming
Cont.
When does dynamic
programming work?
The problem has optimal substructure
Overlapping subproblems (hopefully polynomial in the
input size)
The basic 4 steps
This
looks
like divide
and conquer!
1. Characterize the optimal solutio