Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (3 pts) Describe a dynamic programming algorithm to find the longest monotonically increasing subsequence of a sequence of n integers. 3. (3 pts)

image text in transcribed

2. (3 pts) Describe a dynamic programming algorithm to find the longest monotonically increasing subsequence of a sequence of n integers. 3. (3 pts) Design a dynamic programming algorithm to find the change of n cents using the fewest number of coins given any set of k different coin denominations. For example, coins in America are in denominations of 1, 5, 10, and 25 cents. However, this question does not have any specific denomination. It only assumes that each coin's value is an integer and one of the coins is a penny. 4. (2 pts) Gas stations optimization. There are n gas station S, ..., S, along I-80 from San Francisco to New York. On a full tank of gas your car goes for D miles. Gas station S is in San Francisco, each gas station Si, for 2in, is diD miles after the previous gas station Si- 1, and gas S, is in New York. Compute the minimum number of gas stops you must make when driving from San Francisco to New York. Give the pseudo-code for a greedy algorithm that solves the above optimization problem. Briefly justify why your algorithm finds the optimum solution. What is the asymptotic running time of your algorithm in term of n?

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

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions