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
In the LC-3 data path, the output of the address adder goes to both the MARMUX and the PCMUX, potentially causing two very diffe
dangina [55]

Answer:

no need for that

Explanation:

they are not the same at all

3 0
3 years ago
Write a new ARMv8 assembly file called "lab04b.S" which is called by your main function. It should have the following specificat
Len [333]

Answer:

my_mul:

.globl my_mul

my_mul:

   //Multiply X0 and X1

   //   Does not handle negative X1!

   //   Note : This is an in efficient way to multipy!

   SUB SP, SP, 16       //make room for X19 on the stack

   STUR X19, [SP, 0]    //push X19

   ADD X19, X1, XZR     //set X19 equal to X1

   ADD X9 , XZR , XZR //set X9 to 0

mult_loop:

   CBZ X19, mult_eol

   ADD X9, X9, X0

   SUB X19, X19, 1

   B mult_loop

mult_eol:

   LDUR X19, [SP, 0]

   ADD X0, X9, XZR      // Move X9 to X0 to return

   ADD SP, SP, 16       // reset the stack

   BR X30

Explanation:

6 0
4 years ago
You can help build a safe work environment by using your knowledge of violence prevention strategies to spot what?
Ostrovityanka [42]

Answer:

warning signs

Explanation:

give directions on your surroundings

4 0
3 years ago
(a) The room-temperature electrical conductivity of a semiconductor specimen is 13 (Ω-m)-1. The hole concentration is known to b
Aleksandr-060686 [28]

Answer: a) 0.24E+20 m-3. b) p-type extrinsic.

Explanation:

The current density in a semiconductor is composed by two types of charge carriers: electrons and holes.

This parameter, is proportional to the Electric field within the semiconductor, being the proportionality constant, the electrical conductivity of the material, that takes into account the charge carrier concentrations, and the mobility for each type.

The expression for electrical conductivity is as follows:

σ = q . ne . µe  + q . np . µp  

Replacing by the given values, and the value of q (charge of an electron), we can get the only unknown that remains, ne , as follows:

ne =( σ – (q . np . µp)) / q µe = (13 (Ω.m)-1 – (1.6E-19) coul(4.0E+20) m-3.0.18) m2/V-s /( (1.6E-19).0.38) coul.m2/V-s

ne = 0.24E+20.

As ne is smaller than np, this means that the semiconductor behaves like a p-type extrinsic one.

7 0
3 years ago
By the end of the day, a 45 ft x 25 ft x 8 ft office has a carbon dioxide air level of 1,100 ppm. Determine the time in hours ne
Julli [10]

The total hours that are necessary to reduce carbon dioxide level to at least 325 ppm are 4 hours.

<h3>How does carbon dioxide concentration change over time?</h3>

First hour:

  • 1,100 - 20 %
  • 1,100 - 220 = 880

  • 880 - 20%
  • 880 - 176 = 704

Second hour:

  • 704 - 20%
  • 704 - 140.8 =663.2

  • 663.2 - 20%
  • 663.2 - 132.64 = 530.56

Third hour:

  • 530.56 - 20%
  • 530.56 - 106.112 = 424.44

  • 424.44 - 20%
  • 424.44 - 84.88 = 339.55

Fourth hour:

  • 339.55 - 20%
  • 339.55 - 67.91 = 271.64

Learn more about carbon dioxide in: brainly.com/question/3049557

#SPJ1

6 0
2 years ago
Other questions:
  • For each of the following stacking sequences found in FCC metals, cite the type of planar defect that exists:
    7·1 answer
  • Que es Broadcast Domains?
    15·1 answer
  • Consider two identical 86-kg men who are eating identical meals and doing identical things except that one of them jogs for 30 m
    10·1 answer
  • You just purchased a 400-L rigid tank for a client who works in the gas industry. The tank is delivered pre-filled with 3 kg of
    8·1 answer
  • The slotted link is pinned at O, and as a result of rotation it drives the peg P along the horizontal guide. Compute the magnitu
    15·1 answer
  • A hair dryer is basically a duct of constant diameter in which a few layers of electric resistors are placed. A small fan pulls
    7·1 answer
  • What sub-discipline of Mechanical Engineering focuses
    10·1 answer
  • For methyl chloride at 100°C the second and third virial coefficients are: B = −242.5 cm 3 ·mol −1 C = 25,200 cm 6 ·mol −2 Calcu
    7·1 answer
  • Shops should avoid purchasing any material sold in ____________.
    5·1 answer
  • In approximately 200 words, explain what three factors you believe will have the greatest impact on the future of the green buil
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!