Homework set 6
March 17, 2009
1
Minimizing gas stops
You are driving your car from city A to city B. Along the road connecting the two cities there are gas stations, at distances x1 , x2 , . . . , xn
Analysis of Algorithms
Amotz Bar-Noy
CUNY
Amotz Bar-Noy (CUNY)
Analysis of Algorithms
1 / 56
Algorithm: Definitions
1
A finite set of precise instructions for performing a computation or
for solving a
Finding the GCD
Amotz Bar-Noy
CUNY
Spring 2012
Amotz Bar-Noy (CUNY)
Finding the GCD
Spring 2012
1 / 17
Computing the Greatest Common Divisor
Input: Two integers x > 0 and y > 0.
Output: The maximum in
1
Dealing with Hierarchies
There are many real world situations where the relational model doesnt fit naturally. One of
them are generalizations and specializations from object oriented languages. Oth
1
Loading Data
In a data warehouse environment, theres often a need to load massive amounts of data,
usually at regular intervals (daily, weekly, monthly, etc.). These notes discuss some of the
option
Robust Database Design
Alex S.
I believe the hard part of building software to be the specification, design, and
testing of this conceptual construct, not the labor of representing it and testing
the
1
Stored Procedures
Many modern databases support a more procedural approach to databasesthey allow you
to write procedural code to work with data. Usually, it takes the form of SQL interweaved
with t
Distributed Databases
Alex S.
1
Introduction
For large databases, especially for date warehousing, it often becomes impractical to store
and/or process data on a single physical computer. The problem
1
Indexes
The purpose of an index is much like the purpose of an index in a book: to help us find the
important bits quickly.
1.1
Dense vs Sparse
Just as with book indexes, sparse database indexes don
Big Data Primer
Alex Sverdlov
alex@theparticle.com
1
Why Big Data?
Data has value. This immediately leads to: more data has more value, naturally causing
datasets to grow rather large, even at small c
Analytic Functions
(short intro)
Alex S, http:/theparticle.com/
alex@theparticle.com
Analytic functions (or windowing functions) are a new class of
aggregate functions in SQL that add a summary column
Algorithms: Background
Amotz Bar-Noy
CUNY
Amotz Bar-Noy (CUNY)
Algorithms: Background
1 / 56
What is a Proof?
Definition I: The cogency of evidence that compels acceptance
by the mind of a truth or a
Homework set 8
April 9, 2009
1
Broadcasting in trees
Note: Though this exercise is a bit long, most of it is not hard. It is a good example of what you might expect to see in the test. In the context
Solutions for homework 6
March 20, 2009
1
1.1
In this case the trip is clearly impossible, because there is no way to reach gas station xi+1 .
1.2
The algorithm is the following: starting from A, pick
Solutions for Homework Set 8
April 21, 2009
1
1.1
In the local broadcasting model it would just one round in Kn , because every other vertex is a neighbor of the starting vertex.
1.2
The fastest way i
Solutions for homework 7
March 25, 2009
1
Edges: cfw_(A, E), (E, F ), (B, E), (F, G), (G, H), (C, G), (D, G). Total cost: 19 Another minimum spanning tree can be obtained if we swap (B, F ) for (B, E)
Solutions for homework 9
May 15, 2009
1
1. Yes. P is a subset of NP. 2. No, this would imply that P=NP. 3. No, NP certainly contains problems which are not the hardest in NP. (For example, every probl
Homework set 9
May 14, 2009
1
NP-completeness
1. A is in P 2. A is in NP 3. A is NP-complete 4. B is in P 5. B is in NP 6. B is NP-complete 7. A P B 8. B P A
Here is a list of statements regarding two
Homework Set 5
March 7, 2009
1
The Petersen graph is one of the most famous graphs in graph theory. You can see one drawing of it in Figure 1.
1.1
Give a representation of the Petersen graph using adj
Homework set 7
March 24, 2009
1
Solve Exercises 5.1(a) and 5.1(b) from DPV. For (a), also give the set of edges which make up the spanning tree.
2
Maximum spanning tree
Give an algorithm to compute th
Solutions for Homework 5
March 19, 2009
1
1.1
(Omitted)
1.2
(Omitted)
1.3
(Omitted)
1.4
One minimum vertex cover is cfw_2, 3, 5, 6, 9, 10. This has size 6. This cannot be improved because the graph co
Algorithms: Order Statistics
Amotz Bar-Noy
CUNY
Spring 2012
Amotz Bar-Noy (CUNY)
Algorithms: Order Statistics
Spring 2012
1 / 53
A Search Problem
Input:
An ordered array A of n keys: A[1] A[2] A[n].
A
Name: _
CISC 3220 SAMPLE EXAM 1
For maximum partial credit, show all your work clearly. Be sure your final answers are
clearly marked. You may work on the backs of the pages, but indicate that you are