Question: Using MIPS 32 Name your source code file h3-1.s Let lower and upper be two positive integers with 1 lower, upper 103 and lower upper

Using MIPS 32

Name your source code file h3-1.s Let lower and upper be two positive integers with 1 lower, upper 103 and lower upper. Let a and b be two positive integers with lower a, b upper and a b. Let x = a b. For all pairs of a and b satisfying the specified conditions, find and print the maximal value of x. For example, suppose lower = 10 and upper = 13. The algorithm will compute x for each a, b pair where 10 a, b 13 and a b,

Using MIPS 32 Name your source code file h3-1.s Let lower and

The maximal value of x is 7 when a, b = 10, 13 and a, b = 11, 12. The output from the program should be 7. Here is the pseudocode for the algorithm which solves this problem,

function max_xor (lower : unsigned int, upper : unsigned int) unsigned int

unsigned int a, b, max, x max 0 for a lower to upper do

for b a to upper do

xab

if x > max then max x

end for

end for

return max end function max_xor

function main () unsigned int lower, max, upper

SysPrintStr ("Enter lower? ")

lower SysReadInt()

SysPrintStr ("Enter upper? ")

upper SysReadInt ()

max max_xor (lower, upper)

SysPrintInt (max) SysExit ()

end function main

10 10 10102 10102 00002 10 10 11 10102 10112 00012 10 10 12 1010, 11002 01102 610 10 13 10102 11012 01112 10 11 11 10112 e 10112 00002 010 z 11 12 10112 11002 01112 10 11 13 10112 11012 01102 610 z -12 12 11002 11002 00002 010 12 13 11002 11012 00012 10 13 13 11012 11012 00002 010 10 10 10102 10102 00002 10 10 11 10102 10112 00012 10 10 12 1010, 11002 01102 610 10 13 10102 11012 01112 10 11 11 10112 e 10112 00002 010 z 11 12 10112 11002 01112 10 11 13 10112 11012 01102 610 z -12 12 11002 11002 00002 010 12 13 11002 11012 00012 10 13 13 11012 11012 00002 010

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!