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
harina [27]
3 years ago
11

MIPS Assembly program: Accept N numbers from the user (or list the input array in the program similar to the demo code) and sort

the N numbers using any sorting algorithm. Print both the sorted array and unsorted array. N should be greater than or equal to 10.
Engineering
1 answer:
Snezhnost [94]3 years ago
3 0

Answer:

main:

   la  $t0, Array      # Copy the base address of your array into $t1

   add $t0, $t0, 40    # 4 bytes per int * 10 ints = 40 bytes                              

outterLoop:             # Used to determine when we are done iterating over the Array

   add $t1, $0, $0     # $t1 holds a flag to determine when the list is sorted

   la  $a0, Array      # Set $a0 to the base address of the Array

innerLoop:                  # The inner loop will iterate over the Array checking if a swap is needed

   lw  $t2, 0($a0)         # sets $t0 to the current element in array

   lw  $t3, 4($a0)         # sets $t1 to the next element in array

   slt $t5, $t2, $t3       # $t5 = 1 if $t0 < $t1

   beq $t5, $0, continue   # if $t5 = 1, then swap them

   add $t1, $0, 1          # if we need to swap, we need to check the list again

   sw  $t2, 4($a0)         # store the greater numbers contents in the higher position in array (swap)

   sw  $t3, 0($a0)         # store the lesser numbers contents in the lower position in array (swap)

continue:

   addi $a0, $a0, 4            # advance the array to start at the next location from last time

   bne  $a0, $t0, innerLoop    # If $a0 != the end of Array, jump back to innerLoop

   bne  $t1, $0, outterLoop    # $t1 = 1, another pass is needed, jump back to outterLoop

Explanation:

You might be interested in
Carbon dioxide at 20°C flows in a pipe at a rate of 0.005 kg/s. Determine the minimum diameter required if the flow is laminar (
Vesna [10]

Answer:

the required diameter is 0.344 m

Explanation:

given data:

flow is laminar

flow of carbon dioxide Q = 0.005 Kg/s

for  flow to be laminar,  Reynold's number must be less than 2300 for pipe flow and it is given as

\frac{\rho VD}{\mu }

arrange above equation for diameter

\frac{\rho Q D}{\mu A }<2300

dynamic density of carbon dioxide = 1.47×10^{-5} Pa sec

density of carbon dioxide is 1.83 kg/m³

\frac{1.83\times 0.0056\times D}{1.47\times 10^{-5}\times \frac{\pi}{4} \times D^{2} }

\frac{1.83\times 0.0056}{1.47\times 10^{-5}\times \frac{\pi}{4} \times 2300}= D

D = 0.344 m

4 0
3 years ago
What are the nominal dimensions for a 1x2 stick of lumber, a 2x4 stick of lumber and a standard sheet of plywood?
zlopas [31]
3/4 x 1 1/2 inches (19 x 38 mm) is the actual size for 1x2 stick of lumber,

1 1/2 x 3 1/2 inches (38 x 89 mm) is the actually size for a 2x4 stick of lumber,

Plywood is usually sold in 4 x 8-foot sheets. The most common nominal thicknesses of plywood are 1/2 inch and 3/4 inch, but once again the actual sizes are slightly different. A sheet of 1/2-inch plywood is really 15/32 inch thick, while a 3/4-inch sheet is 23/32 inch thick.

Hopefully this answers your question, I apologize if it doesn’t :)
6 0
3 years ago
Blocks A and B are able to slide on a smooth surface. Block A has a mass of 30 kg. Block B has a mass of 60 kg. At a given insta
creativ13 [48]

Answer and Explanation:

The answer is attached below

6 0
3 years ago
Utility company power lines carry what kind of current?
vagabundo [1.1K]

Answer:

Alternating

Explanation:

8 0
3 years ago
What would be the required voltage of an energy source in a circuit with a current of 10.0 A and a resistance of 11.0 Ω?
Tju [1.3M]

Answer:

  110 V

Explanation:

V = IR

V = (10.0 A)(11.0 Ω) = 110 volts

8 0
3 years ago
Other questions:
  • Two parallel Rivers (A and B) are separated by confined and unconfined aquifer estimate the RATE of seepage of river A to River
    15·1 answer
  • A divided multilane highway in a recreational area has four lanes (two lanes in each direction) and is on rolling terrain. The h
    12·1 answer
  • What are the main causes of injuries when using forklifts?
    12·2 answers
  • For some transformation having kinetics that obey the Avrami equation , the parameter n is known to have a value of 1.1. If, aft
    6·1 answer
  • Can you tell me important facts about Peggy A. Whitson?
    13·2 answers
  • if you’re disassembling a master cylinder and the front piston assembly is stuck in the master cylinder you can
    8·1 answer
  • Ray L. Zapp is thinking about testing strategies for his new HashTable class, which uses Rainforest's cloud storage service to m
    9·1 answer
  • What is the role of engineers in nation building <br><br>​
    13·2 answers
  • 5. What number filter lens is recommended when welding with SMAW and using 1/8" (3.2 mm)
    14·1 answer
  • Technician A says the compressor is the dividing line of the refrigeration system, low- to high-side. Technician B says the expa
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!