Next: About this document
Applied Algorithms Anna Karlin, 426C Sieg
CSE 589, Autumn 1997
Homework # 1
Due in class, October 15
- Big Oh: For each of the following questions, briefly
explain your answer.
- If I prove that an algorithm takes
worst-case time,
is it possible that it takes O(n) on some inputs?
- If I prove that an algorithm takes
worst-case time,
is it possible that it takes O(n) on all inputs?
- If I prove that an algorithm takes
worst-case time,
is it possible that it takes O(n) on some inputs?
- If I prove that an algorithm takes
worst-case time,
is it possible that it takes O(n) on all inputs?
- Is the function
where
for even n
and
for odd n?
- Dynamic Programming:
- Graph representation: Consider an unweighted graph
with n vertices and m edges. The two common data structures
used to represent such a graph are adjacency matrices and adjacency
lists. An adjacency matrix is an
matrix M,
where M[i,j]=1 if there is an edge from vertex i
to vertex j and M[i,j]=0 otherwise. An adjacency list consists
of an n-element array of pointers, where the i-th element
points to a linked list of the edges incident on vertex i.
- For which of adjacency lists and adjacency matrices is it faster to test if a given edge (v,w) is in the graph?
- For which of adjacency lists and adjacency matrices is it faster to
find the degree of a vertex?
- How much memory is used by each of the two data structures (in big Oh
notation)?
- What is the complexity of edge deletion/edge insertion for
the two methods?
- What is the complexity of traversing the graph for the
two methods?
- Depth-first search on a directed graph:
Rewrite the pseudo-code for depth-first
search given in the first lecture, so that it prints out,
for each edge examined, whether the edge is a tree edge,
a back edge, a forward edge or a cross edge.
- We discussed (sometimes briefly) the following in the first lecture.
- Traversing a graph using depth-first search
- Traversing a graph using breadth-first search.
- Finding the connected components of an undirected graph.
- Finding the strongly connected components of a directed
graph.
- Determining if a directed or undirected graph has a cycle.
- Topologically sorting a directed acylic graph.
- Testing a graph for planarity.
- Finding a minimum spanning tree for a weighted graph.
For each of the following problems, describe how it could
be modeled as a graph problem and solved with the aid
of one or more of the above known algorithms, or ideas
involved therein.
I have purposely left these problems somewhat vague....
- Given a set of processes that need to be scheduled,
and dependencies that tell you which processes need to be completed
in order for a given process to execute, how would you schedule the
processes so as not to violate any of the dependencies?
- How would you find your way out of a maze using a very
large collection of pennies?
- DNA sequences - you are given experimental data consisting of small
DNA fragments. For each fragment f, it has been determined experimentally
that certain fragments lie to the left of f on the chromosome,
certain fragments lie to the right of f, and the rest can be on
either side. How would you go about finding a consistent ordering
of the fragments from left to right that satisfies all the constraints?
- Broadcast - suppose a given processor on a network wishes
to broadcast a message to all other processors. How would you go
about routing the message to all the other processors as efficiently
as possible?
You can assume that you have information about the bandwidth
and congestion on the various links in the network.
- Circuit simulation - Given a circuit layout and input/output
information for each gate in the circuit (where its outputs
go and where its inputs come from) how would you schedule the
simulation of the gates in the circuit?
- Graphics- A triangle
strip is a sequence of triangles,
such that
shares exactly one edge with
and
exactly one (other edge) with
, for each 1<i <n.
Rendering engines are often able to
very efficiently render a ``triangle strip'', much more
efficiently than they can render each of the n individual
triangles.
Given a large set of triangles (given by the 3D coordinates
of the three vertices of each triangle), how would you go about constructing
a set of maximal triangle strips to feed to the renderer.
Next: About this document
Nitin Sharma
Mon Oct 6 11:17:58 PDT 1997