{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework 2 - m is minimized 2 Page 173 Excercise 8.3-4 Show...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
W07/CS592 Homework Two Design and Analysis of Algorithms Due: Feb. 13, 2007 There are four problems 1 There are n houses located on a west-east street. H[ i ] (meters), 1 i n , is the distance from the west-end of the street to the i th house. You may assume that H[1] < H[2] < H[3] < … < H[ n ]. There is no post office on the street. We plan to build several post offices on the street such that any house can reach a post office within 100 meters. Please design an O( n ) algorithm to compute the locations for the post offices, P[ j ] (meters), 1 j m , where P[ j ] is the distance from the west-end of the street to the j th post office. Make sure that the number of post offices,
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: m , is minimized. 2 Page 173, Excercise 8.3-4. Show how to sort n integers in the range 0 to n 2-1 in O( n ) time 3 Page 384, Exercise 16.2-3. Suppose that in a 0-1 knapsack problem, the order of the items when sorted by increasing weight is the same as their order when sorted by decreasing value. Give an efficient algorithm to find an optimal solution to this variant of the knapsack problem, and argue that your algorithm is correct. 4 Re-consider the problem of constructing the min-order binary tree for array A[1], A[2], …, A[ n ] in homework one. Please design a greedy algorithm that needs Θ ( n ) time in worst case. 1...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern