The Eastern Reserve Logistics Company operates under the ass

The Eastern Reserve Logistics Company operates under the assumption that it needs a single vehicle for deliveries over thenext n months. The vehicle can be leased at various costs and for various lengths of time: a three-month plan for $a, a four-month plan for $b, and a five-month plan for $c. The company can subscribe to a leasing plan beginning any month. The company has plenty of available parking and, although only one vehicle is required, it can lease additional unused vehicles if it helps with leasing costs.

Describe a recursive algorithm that returns the smallest leasing cost.

Solution

ALGORITHM:-

it is a finite sequence of the instructions or the steps in which order things are to be performed.it is a way of making workplan,which makes things clear,like whaat we want where we want and when we want.

RECURSIVE ALGORITHM:-

a recursive algorithm is a way of solving a problem,with lesss instance or we can say smaller steps,short for,to attain the result.in it solution is computed directly without makig any algorithmcalls.a recursive algorithm have two basic parts

1.base part: where solution is computed directly

2.recursive part: solution is computed by making one or more calls using smaller inputs in an algorithm.

so when we want tto plot a recursive algorithm or recursive tree.,we need to follow there two steps,of developing base tre and then developing recursive tree.

so for above proble lets develop an recursive algorithm.

1DEVELOPE THE BASE PART:

1.the smallest input here is n=1,thus the output will be 1,as the sum of the array will be 1.in other wors we can say that if n=1,sum will be 1.

2.DEVELOPING RECURSIVE PART

here for n>=1,there will be n+1 solution,

according to the condition provided ,

vehicle can be levid for more than one month also,where

if n=1,price=a$

n=4,price =b$

n=5,price=c$

The Eastern Reserve Logistics Company operates under the assumption that it needs a single vehicle for deliveries over thenext n months. The vehicle can be leas

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site