CSCI-GA.1170-001/002 Fundamental Algorithms
November 13, 2012
Problem Set 7
Lecturer: Yevgeniy Dodis
Due: Tuesday, November 20
Problem 7-1 (Bracketings)
8 (+7) Points
Imagine a unary alphabet with a single letter x. A (valid) bracketing B is a string over
CSCI-GA.1170-001/002 Fundamental Algorithms
October 9, 2012
Problem Set 6
Lecturer: Yevgeniy Dodis
Due: Wednesday, October 17
Problem 6-1 (Find the Josephus Permutation)
10 points
According to Josephus account of the siege of Yodfat, he and his n comrade
CSCI-GA.1170-001/002 Fundamental Algorithms
September 23, 2012
Problem Set 3
Lecturer: Yevgeniy Dodis
Due: Tuesday, September 25
Problem 3-1 (Recurrences and Matrix Exponentiation) 18 points
The sequence cfw_Fn | n 0 are dened as follows: F0 = 1, F1 = 1,
CSCI-GA.1170-001/002 Fundamental Algorithms
September 9, 2012
Problem Set 1
Lecturer: Yevgeniy Dodis
Due: Tuesday, September 11
Problem 1-1 (Counting Inversions)
10 points
Let A[1, . . . , n] be an array of n distinct numbers. If i < j and A[i] > A[j ], t
CSCI-GA.1170-001/002 Fundamental Algorithms
December 7, 2012
Problem Set 10
Lecturer: Yevgeniy Dodis
Due: Tuesday, December 11
Problem 10-1 (Second Smallest Spanning Tree)
13 (+5) points
(a) (3 points) Using the correctness of the Kruskal/Prim algorithm,
Fundamental Algorithms, Assignment 7
Solutions
1. Determine an LCS of 10010101 and 010110110.
Solution:We create an eight by eight array giving C[m, n], the length
of the LCS between the first m of the first sequence and the first n of
the second sequence
Fundamental Algorithms, Assignment 9
Due April 13/14 in Recitation
For every complex problem there is a simple solution. And its
always wrong.
H.L. Mencken, 1880-1956, American satirist.
1. (*) Suppose that the Huffman Code for cfw_v, w, x, y, z has 0 or
Fundamental Algorithms, Assignment 8
Solutions
1. Set W = N . We are given P RICE[I], 1 I W , the price of a
rod of length I. Give a program that will output the optimal revenue
for a rod of length N 2 and give the time, in -land, of the algorithm.
Use an
CSCI-GA.1170-001/002 Fundamental Algorithms
September 23, 2015
Problem Set 3
Lecturer: Yevgeniy Dodis
Due: Tuesday, September 29
Problem 3-1 (Stock Prot)
10 (+5) Points
Sometimes, computing extra information can lead to more ecient divide-and-conquer algo
/*
* scorer for NLP class Spring 2016
* ver.1.0
*
* score a key file against a response file
* both should consist of lines of the form:
* sentences are separated by empty lines
*/
import
import
import
import
token \t tag
java.util.*;
java.io.*;
java.nio.
disappointing
class
.
davi
only
gave
2
lectures
,
the
rest
were
classes
explaining
the
homework
.
he
clearly
made
no
effort
to
prepare
lessons
,
a
syllabus
,
slides
,
etc
.
Grades
were
based
100%
on
the
final
project
,
he
gave
everyone
a
B
for
their
midt
disappointing N
class N
. .
davi N
only N
gave N
2 N
lectures N
, ,
the N
rest N
were N
classes N
explaining N
the N
homework N
. .
he N
clearly N
made N
no N
effort N
to N
prepare N
lessons N
, ,
a N
syllabus N
, ,
slides N
, ,
etc N
. .
Grades N
were N
disappointing N
class N
. .
davi N
only N
gave N
2 N
lectures N
, ,
the N
rest N
were N
classes N
explaining N
the N
homework N
. .
he N
clearly N
made N
no N
effort N
to N
prepare N
lessons N
, ,
a N
syllabus N
, ,
slides N
, ,
etc N
. .
Grades N
were N
disappointing N
class N
. .
davi N
only N
gave N
2 N
lectures N
, ,
the N
rest N
were N
classes N
explaining N
the N
homework N
. .
he N
clearly N
made N
no N
effort N
to N
prepare N
lessons N
, ,
a N
syllabus N
, ,
slides N
, ,
etc N
. .
Grades N
were
Homework
assignments
are
incredibly
time-consuming
.
He
often
merely
skims
over
info
that
's
central
to
the
hw
,
or
doesn
't
even
get
to
the
topic
until
the
day
it
's
due
.
Tests
were
way
too
long
.
For
both
midterms
,
the
multi
choice
questions
came
fro
Homework N
assignments N
are N
incredibly N
time-consuming N
. .
He N
often N
merely N
skims N
over N
info N
that N
's N
central N
to N
the N
hw N
, ,
or N
doesn N
't N
even N
get N
to N
the N
topic N
until N
the N
day N
it N
's N
due N
. .
Tests
Prof. Spencer
March 27, 2017
FUNDAMENTAL ALGORITHMS MIDTERM
SOLUTIONS
1. (15) Let A[1 N ] be an array with all entries integers between 0 and
N 1. How long would RADIX-SORT take to sort A assuming that we
use base 2 (that is, binary)? (Assume the enries A
Prof. Spencer
March 27, 2017
FUNDAMENTAL ALGORITHMS MIDTERM
Every true scientist has in his lifetime just one idea, and his life
is its embodiment. Nikolai Luzin
Maximum Score 105. Do all problems.
1. (15) Let A[1 N ] be an array with all entries integers
CSCI-GA.1170-001/002 Fundamental Algorithms
November 27, 2012
Problem Set 9
Lecturer: Yevgeniy Dodis
Due: Tuesday, December 04
Problem 9-1 (SOLE Encoding)
9 points
Let B = 64, and the actual block alphabet = cfw_0, . . . 9, a, . . . , z, A, . . . , Z, . (
CSCI-GA.1170-001/002 Fundamental Algorithms
November 14, 2012
Problem Set 8
Lecturer: Yevgeniy Dodis
Due: Tuesday, November 27
Problem 8-1 (Uninterrupted Television)
14 Points
Little Johnny is extremely fond of watching television. His parents are o for w
CSCI-GA.1170-001/002 Fundamental Algorithms
October 2, 2012
Problem Set 5
Lecturer: Yevgeniy Dodis
Due: Tuesday, October 9
Problem 5-1 (Sorting in O(n log log n) time)
10 points
(a) (4 points) Suppose we want to sort an array A of n elements from the set
CSCI-GA.1170-001/002 Fundamental Algorithms
September 26, 2012
Problem Set 4
Lecturer: Yevgeniy Dodis
Due: Tuesday, October 2
Problem 4-1 (Improving Deterministic Quicksort)
16 points
We give the following procedure StrangeSort to sort an array A of n dis
CSCI-GA.1170-001/002 Fundamental Algorithms
September 11, 2012
Problem Set 2
Lecturer: Yevgeniy Dodis
Due: Tuesday, September 18
Problem 2-1 (Mergesort)
10 points
(a) (6 points) Suppose you have some procedure FASTMERGE that given two sorted lists of
leng
3E due PM My lean/m
Funda ental Algorithms. HW 8 Solutions
7.1 Let G be an undirected graph, and suppose that G contains the edge e = cfw_11,111. By denition, a. (standard)
BFS processes the vertices level-by-level, where the current level is in a queue,
Fundamental Algorithms.
For Thursday, Oct 20 @ 10PM: please submit your self-evaluations for HW 6.
Homework 6 Solutions
11.20 a) Computing AX B x C x D x E. The dimensions are (20 X 100), (100 x 10), (10 X 20), (20 X 100)(100 x 5).
Pairwise costs ,
AXB B
Basic Algorithms Hw3 solutions
For Thursday, Sept. 22 @ 11PM:
Please submit a self evaluation of l-IW2
Assignment 3: I am not sure that we will cover enough this week, so a few problems may be deleted, or the
due might be changed. An NYUCLASSES announceme