hw2(4) - CS 373U: Combinatorial Algorithms, Spring 2004...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 373U: Combinatorial Algorithms, Spring 2004 Homework 2 Due Friday, February 20, 2004 at noon (so you have the whole weekend to study for the midterm) Name: Net ID: Alias: Name: Net ID: Alias: Name: Net ID: Alias: • Starting with this homework, we are changing the way we want you to submit solutions. For each numbered problem, if you use more than one page, staple all those pages together. Please do not staple your entire homework together. This will allow us to moreeasily distribute the problems to the graders. Remember to print the name and NetID of every member of your group, as well as the assignment and problem numbers, on every page you submit. You do not need to turn in this cover page. • Unless specifically stated otherwise, you can use the fact that the following problems are NP- hard to prove that other problems are NP-hard: Circuit-SAT, 3SAT, Vertex Cover, Maximum Clique, Maximum Independent Set, Hamiltonian Path, Hamiltonian Cycle, k-Colorability for any k ≥ 3, Traveling Salesman Path, Travelling Salesman Cycle, Subset Sum, Partition, 3Partition, Hitting Set, Minimum Steiner Tree, Minesweeper, Tetris, or any other NP-hard problem described in the lecture notes. • This homework is a little harder than the last one. You might want to start early. # 1 2 3 4 5 6 * Total Score Grader CS 373U Homework 2 (due February 20, 2004) Spring 2004 1. In lecture on February 5, Jeff presented the following algorithm to compute the length of the longest increasing subsequence of an n-element array A [1 ..n ] in O ( n 2 ) time. LengthOfLIS ( A [1 ..n ]): A [ n + 1] = ∞ for i ← 1 to n + 1 L [ i ] ← 1 for j ← 1 to i- 1 if A [ j ] < A [ i ] and 1 + L [ j ] < L [ i ] L [ i ] ← 1 + L [ j ] return L [ n + 1]- 1 Describe another algorithm for this problem that runs in O ( n log n ) time. [Hint: Use a data structure to replace the inner loop with something faster.]structure to replace the inner loop with something faster....
View Full Document

This note was uploaded on 10/14/2011 for the course ECON 101 taught by Professor Smith during the Spring '11 term at West Virginia University Institute of Technology.

Page1 / 4

hw2(4) - CS 373U: Combinatorial Algorithms, Spring 2004...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online