next up previous
Next: About this document


Applied Algorithms Anna Karlin, 426C Sieg
CSE 589, Autumn 1997

Homework # 1
Due in class, October 15

  1. Big Oh: For each of the following questions, briefly explain your answer.
    1. If I prove that an algorithm takes tex2html_wrap_inline385 worst-case time, is it possible that it takes O(n) on some inputs?
    2. If I prove that an algorithm takes tex2html_wrap_inline385 worst-case time, is it possible that it takes O(n) on all inputs?
    3. If I prove that an algorithm takes tex2html_wrap_inline393 worst-case time, is it possible that it takes O(n) on some inputs?
    4. If I prove that an algorithm takes tex2html_wrap_inline393 worst-case time, is it possible that it takes O(n) on all inputs?
    5. Is the function tex2html_wrap_inline401 where tex2html_wrap_inline403 for even n and tex2html_wrap_inline407 for odd n?

  2. Dynamic Programming:
  3. 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 tex2html_wrap_inline479 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.
  4. 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.
  5. We discussed (sometimes briefly) the following in the first lecture.

    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....

    1. 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?
    2. How would you find your way out of a maze using a very large collection of pennies?
    3. 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?
    4. 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.
    5. 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?
    6. Graphics- A triangle strip is a sequence of triangles, tex2html_wrap_inline499 such that tex2html_wrap_inline501 shares exactly one edge with tex2html_wrap_inline503 and exactly one (other edge) with tex2html_wrap_inline505, 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 up previous
Next: About this document

Nitin Sharma
Mon Oct 6 11:17:58 PDT 1997