1. input a, b, c, M 2. to ← a; t₁ ←b; yo ← ƒ (to) ; Y₁ ← ƒ (t₁) 3. call MAX (f, to, t₁, C₁, di) 4. for n=1,2,..., M - 1 do A. B. C. select į so that di = max {d₁, d₂, ..., dn} if di ≤ & exit loop for j = n, n-1,...,i +1 do a. tj+1+tj b. yj+1+Yj dj+1 +d; Cj+1+Cj C. d. D. end E. ti+1+ti F. Yi+1+Yi G. ti ← Ci H. Yi + f (C₁) I. call MAX (f, ti-1, ti, Ci, di) J. call MAX (f, ti, ti+1, Ci+1, di+1) 5. end 6. output n, (to, t₁, . . . , tn), (yo, Y₁, . . . , Yn), (d₁, d2, ..., dn)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question

Python code!

Use np.insert and np.delete can help update t, y, c and d 

1. input a, b, c, M
2. toa; t₁b; yo ← ƒ (to); y₁ ← f (t₁)
3. call MAX (f, to, t₁, C₁, di)
4. for n = 1,2,..., M - 1 do
A.
B.
C.
select i so that d; = max {d₁, d₂, ..., dn}
if die exit loop
for j = n, n-1,...,i + 1 do
a. tj+1 + tj
b.
C.
c.
d.
Yj+1 Yj
dj+1 dj
-
Cj+1 ← Cj
+
D. end
E. ti+1 ←tį
F. Yi+1 ← Yi
G. ti ← Ci
H. Yi ← f (C₂)
I. call MAX (f, ti-1, ti, Ci, di)
J. call MAX (f, ti, ti+1, Ci+1, di+1)
5. end
6. output n, (to, t₁,..., tn), (Yo, Y₁, ..., Yn), (d₁, d2, ..., dn)
Transcribed Image Text:1. input a, b, c, M 2. toa; t₁b; yo ← ƒ (to); y₁ ← f (t₁) 3. call MAX (f, to, t₁, C₁, di) 4. for n = 1,2,..., M - 1 do A. B. C. select i so that d; = max {d₁, d₂, ..., dn} if die exit loop for j = n, n-1,...,i + 1 do a. tj+1 + tj b. C. c. d. Yj+1 Yj dj+1 dj - Cj+1 ← Cj + D. end E. ti+1 ←tį F. Yi+1 ← Yi G. ti ← Ci H. Yi ← f (C₂) I. call MAX (f, ti-1, ti, Ci, di) J. call MAX (f, ti, ti+1, Ci+1, di+1) 5. end 6. output n, (to, t₁,..., tn), (Yo, Y₁, ..., Yn), (d₁, d2, ..., dn)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Lower bounds sorting algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr