Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (a) (3 points) Your friend wish to drive by car from point A to point B on a highway and want to make as

image text in transcribed

1. (a) (3 points) Your friend wish to drive by car from point A to point B on a highway and want to make as few gas stops as possible along the way. The car, when full, has enough gas to travel k miles, and your friend has a map which gives distances between different gas stations on the route. Give an efficient method to determine which gas stations your friend should stop. Prove that your strategy yields an optimal solution (b) (3 points) Consider the problem of making change for n cents using the least number of coins. Describe a greedy algorithm to make change consisting of quarters, dimes, nickels and pennies. Prove that your algorithm yields an optimal solution (c) (3 points) Does your algorithm in part (b) give an optimal solution for any types of dk, for some integer k. Assume that each d, is an integer coin denominations d1, d2, , and 1 is part of it. Note that part (b) has 4 types of coin denominations: 25, 10, 5, and 1. If your answer is yes then prove it, otherwise give a counter example

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions