Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

algorithm design and analysis Q1: There are n neighborhoods in Indiana. You are given a map where neighborhoods are vertices and adjacent neighborhoods are connected

algorithm design and analysis

Q1: There are n neighborhoods in Indiana. You are given a map where neighborhoods are vertices and adjacent neighborhoods are connected by an edge (each neighborhood has at least one adjacent neighborhood). Suppose we would like to open some stores in Indiana, so that everyone can either go to a store in his/her neighborhood, or a store in an adjacent neighborhood. However, due to budget, we can only open at most n/2 stores.

* Design an algorithm that returns at most n/2 neighborhoods, such that if there is a store in these each one of these neighborhoods, everyone can find a store either in their neighborhood or in at least one of the adjacent neighborhoods.

* Will your algorithm always return an optimal solution, i.e., one that opens the smallest number of stores on a map? Give a proof or a counterexample.

Q2 : We are given a directed acyclic graph G. For simplicity, assume the vertices of G are {1, 2, , n} and G contains m edges. The m edges are given by m tuples of the form (i, j, c), where each tuple (i, j, c) defines a directed edge of value c from vertex i to vertex j. We assume all tuples (i, j, c) satisfy 1 i < j n and c > 0. The goal of the problem is to compute a path from 1 to n with the maximum total value. Design an O(m)-time algorithm for the problem.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

What are the objectives of participative budgeting?

Answered: 1 week ago

Question

1. Which position would you take?

Answered: 1 week ago