Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (12 pts) In the two problems below, you are given a subroutine' that can solve one problem quickly, and you are asked to construct

image text in transcribed

2. (12 pts) In the two problems below, you are given a subroutine' that can solve one problem quickly, and you are asked to construct an algorithm that uses the subroutine to solve a different problem (a) (6 pts: 2 pts description of algorithm, 2 pts analysis of runtime, 2 pts correctness) 3-Coloring: A graph is 3-colorable if it is possible to color each vertex red, green, or blue, so that for every edge, its two vertices have two different colors. Suppose you have a subroutine 3color(G) that takes a graph G as input and returns TRUE if G can be 3-colored and FALSE otherwise. Assume that 3color(G) takes O(n) time where n is the number of vertices in G and use it to design an algorithm that actually constructs a 3-coloring of a given graph (if one exists) as quickly as possible. Your algorithm should run in polynomial time (try to achieve O(n ime) and make use of the subroutine. Describe the algorithm, explain why it is correct and give the runtime. (b) (6 pts: 2 pts description of algorithm, 2 pts analysis of recursion, 2 pts correctness) Traveling Salesman: A Hamiltonian cycle in a graph is a cycle that visits every vertex exactly once. Given a complete graph where every edge has a positive weight, the traveling salesman cycle is the Hamiltonian cycle with minimum total weight; that is, the sum of the weight of the edges is smaller than for any other Hamiltonian cycle Suppose you have a subroutine Hamcycle(G) that returns a number that is the weight of the optimal traveling salesman cycle of a weighted graph in O(n) time where n is the number of vertices in the graph G. Describe an algorithm that actually constructs the traveling salesman cycle of a given weighted graph as quickly as possible. Describe the algorithm, explain why it is correct and give the runtime

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_2

Step: 3

blur-text-image_3

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

A phone call to a supplier to check on an overdue parts shipment

Answered: 1 week ago