1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivahew [28]
3 years ago
5

MODIFIED-BOTTOM-UP-CUT-ROD(p, n, c) to return not only the value but the actual solution, too. Hint: It is similar to how array

s is maintained in EXTENDED-BOTTOM-UP-CUT-ROD. Now you need to initialize not just array r but also array s in EXTENDED-MEMOIZED-1 let r[0..n] and s[0..n] be new arrays2 r[0] = 03 for j = 1 to n4 q = p[ j ]5 s[ j ] = j6 for i = 1 to j - 17 if q < p[ i ]+ r[ j - i ] - c8 q = p[ i ]+ r[ j - i ] - c9 s[ j ] = i10 r[ j ] = q11 return r and s3
Engineering
1 answer:
Vaselesa [24]3 years ago
8 0

Answer:

b.

Matrix chain multiplication

M[i,j] = M[i,k] + M[(k+1),j] + p[i-1]*p[k]*p[j] i<=k<j

p[] = {5,10,3,12,5,50}

M[0][0] = 0,M[1][1] = 0,M[2][2] = 0,M[3][3] = 0,M[4][4] = 0,M[5][5] = 0,

M[1][2] = M[1][1]+M[2][2]+p[0]*p[1]*p[2] = 0+0+5*10*3 = 150

M[2][3] = M[3][3]+M[2][2]+p[1]*p[2]*p[3] = 0+0+10*3*12 = 360

M[3][4] = M[3][3]+M[4][4]+p[2]*p[3]*p[4] = 0+0+3*12*5 = 180

M[4][5] = M[4][4]+M[5][5]+p[3]*p[4]*p[5] = 0+0+12*5*50 = 3000

M[1][3] = min{M[1][1]+M[2][3]+p[0]*p[1]*p[3] , M[1][2]+M[3][3]+p[0]*p[2]*p[3]}

= {0 + 360 + 600 , 150+0+180} = {960,330} = 330

M[2][4] = min{M[2][2]+M[3][4]+p[1]*p[2]*p[4] , M[2][3]+M[4][4]+p[1]*p[3]*p[4]}

= {0 + 180 + 150 , 360+0+600} = {960,330} = 330

M[3][5] = min{M[3][3]+M[4][5]+p[2]*p[3]*p[5] , M[3][4]+M[5][5]+p[2]*p[4]*p[5]}

= {0 + 3000 + 1800 , 180+0+750} = {4800,930} = 930

M[1][4] = min{M[1][1] + M[2][4] +p[0]*p[1]*p[4] ,M[1][2] + M[3][4] +p[0]*p[2]*p[4] ,

M[1][3] + M[4][4] +p[0]*p[3]*p[4]}

{0+330+250 , 150+180+75 , 330+0+300} = 405

M[2][5] = min{M[2][2] + M[3][5] +p[1]*p[2]*p[5] ,M[2][3] + M[4][5] +p[1]*p[3]*p[5] ,

M[2][4] + M[5][5] +p[1]*p[4]*p[5]}

{0+930+1500 , 360+3000+6000,330+0+2500} = 2430

M[1][5] = min{M[1][1] +M[2][5]+p[0]*p[1]*p[5] , M[1][2] +M[3][5]+p[0]*p[2]*p[5],

M[1][3] +M[4][5]+p[0]*p[3]*p[5] , M[1][4] +M[5][5]+p[0]*p[4]*p[5]}

{0+2430+2500 , 150+930+750 , 330+3000+3000 , 405+0+1250} = 1655

(a)

MemoizedCutRod(p, n)

r: array(0..n) := (0 => 0, others =>MinInt)

return MemoizedCutRodAux(p, n, r)

MemoizedCutRodAux(p, n, r)

if r(n) = 0 and then n /= 0 then -- check if need to calculate a new solution

q: int := MinInt

for i in 1 .. n loop

q := max(q, p(i) + MemoizedCutRodAux(p, n-i, r))

end loop

end if

r(n) := q

end if

return r(n)

You might be interested in
When were dresses made
klio [65]

Answer:

The world's oldest dress called the Tarkhan Dress is at 5,100 to 5,500 years of age.

Does that help? Or do you need something else? I can change my answer if this is not what you need! :D

Explanation:

6 0
3 years ago
By using order of magnitude analysis, the continuity and Navier-Stokes equations can be simplified to the Prandtl boundary-layer
Mademuasel [1]

Answer: Attached below is the well written question and solution

answer:

i) Attached below

ii) similar parameter =  \frac{V}{VoL } = 1 / Re

Explanation:

Using ;  L as characteristic length and Vo as reference velocity

i) Nondimensionalize the equations

ii) Identifying similarity parameters

the similar parameters are  = \frac{V}{VoL } = 1 / Re

Attached below is the detailed solution

7 0
3 years ago
Water flows through a converging pipe at a mass flow rate of 25 kg/s. If the inside diameter of the pipes sections are 7.0 cm an
ser-zykov [4K]

Answer:

volumetric flow rate = 0.0251 m^3/s

Velocity in pipe section 1 = 6.513m/s

velocity in pipe section 2 = 12.79 m/s

Explanation:

We can obtain the volume flow rate from the mass flow rate by utilizing the fact that the fluid has the same density when measuring the mass flow rate and the volumetric flow rates.

The density of water is = 997 kg/m³

density = mass/ volume

since we are given the mass, therefore, the  volume will be mass/density

25/997 = 0.0251 m^3/s

volumetric flow rate = 0.0251 m^3/s

Average velocity calculations:

<em>Pipe section A:</em>

cross-sectional area =

\pi \times d^2\\=\pi \times 0.07^2 = 3.85\times10^{-3}m^2

mass flow rate = density X cross-sectional area X velocity

velocity = mass flow rate /(density X cross-sectional area)

velocity = 25/(997 \times 3.85\times10^{-3}) = 6.513m/s

<em>Pipe section B:</em>

cross-sectional area =

\pi \times d^2\\=\pi \times 0.05^2= 1.96\times10^{-3}m^2

mass flow rate = density X cross-sectional area X velocity

velocity = mass flow rate /(density X cross-sectional area)

velocity = 25/(997 \times 1.96\times10^{-3}) = 12.79m/s

7 0
3 years ago
Example 1: the two dimensional points P1(0,0) and P2(1,0) and the two tangents P', (1,1) and P2 (0,-1).find the equation of the
Stells [14]

Answer: (0,0)+ (1,0)= 1 lines upwards( suggesting that this is a line graph not saying it is but as an example) an (1,1) and (0,-1) all make a small square ( as this is a 2 dimensional graph that it has a negative side too,(below the positive side)) i hope this helps and is what you are looking for

Explanation:

6 0
3 years ago
PLEASE HELP ME!!!!!! IM LOW ON POINTS BUT I NEED SOME HELP, QUICK!!! POINTS FOR HELPFUL ANSWERS + BRAINLIEST!!!!!
meriva

Answer:

Kitchen sinks can be clogged for a few reasons, food hair, and other things. Overtime, buildup of these things lead to clogging.

A few methods to fix clogging are, baking soda mixture, plunging, and boiling water.

The first method, baking soda mixture, what you do is you pour a cup of baking soda and vinegar down the drain, and place a rubber stopper to cover the drain opening. Wait 10 or more minutes, and take out the stopper, and run hot tap water until it's unclogged.

The second method is plunging. Make sure the sink has enough water to submerge the plunger, and start plunging. While you are plunging, maintain a good seal to get the best results. This usually works, but sometimes it doesn't.

The last method is boiling water. Pour boiling water into the drain, then after a while, the clogged drain should unclog, if it doesn't repeat the process until necessary.

Explanation:

8 0
3 years ago
Other questions:
  • Tadpoles raised in water with atrazine levels of 0.1 ppb should produce a higher percentage of male frogs with gonadal abnormali
    13·1 answer
  • If the value of the feedback resistor in the filter is changed but the value of the resistor in the forward path is unchanged, w
    14·1 answer
  • An offshore oil rig will drill into the ocean floor which is located 1 mile below the water surface. Determine the pressure at t
    11·1 answer
  • Does a thicker core make an electromagnet stronger?
    15·2 answers
  • A carbon resistor has a resistance of 976 ohms at 0 degrees C. Determine its resistance at 89 degrees C​
    6·1 answer
  • Assume that Randy’s photocopying Service charges $.10 per photocopy. If fixed costs are
    13·1 answer
  • Plz watch our you tube channel called addie nahoe. I got 8 subscribers. I need 10. Plz like and hit that nocation bell. Plz!!!!
    12·1 answer
  • When block C is in position xC = 0.8 m, its speed is 1.5 m/s to the right. Find the velocity of block A at this instant. Note th
    14·1 answer
  • Moonbeam-Musel (MM), a manufacturer of small appliances, has a large injection molding department. Because MM's CEO, Crosscut Sa
    13·1 answer
  • At an open or uncontrolled intersection, yield if _____.<br> Need Help
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!