Fall 2013
CS 513: #1 Math Fundamentals
Farach-Colton
Due by the beginning of class, Sept. 18.
1. Prove: A binary tree with n nodes has depth at least log n and at most n 1. (Hint:
Show that if a binary tree has depth d and has n nodes, then n 2d+1 1.)
2.
Fall 2011
CS 513: #1 Math Fundamentals
Farach-Colton
Due by the beginning of class, Sept. 13.
1. Prove: A binary tree with n nodes has depth at least log n and at most n 1. (Hint:
Show that if a binary tree has depth d and has n nodes, then n 2d+1 1.)
2.
Fall 2013
Farach-Colton
CS 513
Solutions to #1 Math Fundamentals
1. Prove: A binary tree with n nodes has depth at least log n and at most n 1. (Hint:
Show that if a binary tree has depth d and has n nodes, then n 2d+1 1.)
Proof: We rst prove the hint by
Fall 2013
Farach-Colton
CS 513
Solutions to #2
1. Find a closed form for the recurrence:
T (1) = 1
T (n) = 2T (n/2) + log n (for n 2)
You may assume n is a power of 2. Give a tight big-oh bound on T . Show
your derivation and prove your answer is correct.
Fall 2011
CS 513: #4
Farach-Colton
Due by the beginning of class, Oct. 4.
1. The Longest Common Prefix problem is dened as follows:
Preprocess: D = cfw_S1 , . . . , Sn , Si m , that is D is a set of n strings, each
of which is of length m.
Queries: LCP (i
Fall 2013
CS 513: #2
Farach-Colton
Due by the beginning of class, Sep. 25.
1. Find a closed form for the recurrence:
T (1) = 1
T (n) = 2T (n/2) + log n (for n 2)
You may assume n is a power of 2. Give a tight big-oh bound on T . Show
your derivation and p
Fall 2013
CS 513: #3
Farach-Colton
Due by the beginning of class, October 2.
1. Suppose that you are given an k -sorted array, in which no element is farther than
k positions away from its nal (sorted) position. Give an algorithm which will sort
such an a
Fall 2011
CS 513: #3
Farach-Colton
Due by the beginning of class, Sept. 27.
1. Suppose that you are given an k -sorted array, in which no element is farther than
k positions away from its nal (sorted) position. Give an algorithm which will sort
such an ar
Fall 2011
CS 513: #07
Farach-Colton
Due by the beginning of class, Dec. 6.
1. A boolean formula is in Disjunctive Normal Form if = 1 . . . k ,
where each i = i1 iji . That is, it is the disjunction of a sequence of
conjunctions. The DNF problem is dened a
Fall 2011
CS 513: #6
Farach-Colton
Due by the beginning of class, Nov. 8.
1. A palindrom is a string that reads the same forwards and backwards, like Able
was I ere I saw Elba or Lonenly Tylenol (in this case if you ignore the spaces).
Given a string, a p
Fall 2011
CS 513: #5
Farach-Colton
Due by the beginning of class, Oct. 11.
1. Let A[1, n] be an array of numbers. Dene the cartesian tree, CA , of A recursively, as follows. If n = 1, then CA is a node with value A[1]. Otherwise, let
A[i] be a minimal ele
Fall 2011
CS 513: #2
Farach-Colton
Due by the beginning of class, Sep. 20.
1. Find a closed form for the recurrence:
T (1) = 1
T (n) = 2T (n/2) + log n (for n 2)
You may assume n is a power of 2. Give a tight big-oh bound on T . Show
your derivation and p