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
If a motorist moves with a speed of 30 km/hr, and covers the distance from place A to place B
Sergio039 [100]

Answer:

105 km

Explanation:

The motorist was going 30 km/hr, and it took 3 hours 30 minutes. That's 3.5 hours. 3.5×30=105

5 0
4 years ago
Carbon resistors often come as a brown cylinder with colored bands. These colored bands can be read to determine the manufacture
alexandr1967 [171]

Answer:

a) 4.7 kΩ, +/- 5%

b) 2.0 MΩ, +/- 20%

Explanation:

a) If the resistor has the following combination of color bands:

1) Yellow = 1st digit = 4

2) Violet = 2nd digit = 7

3) Red = multiplier = 10e2

4) Gold = tolerance = +/- 5%

this means that the resistor has 4700 Ω (or 4.7 kΩ), with 5% tolerance.

b) Repeating the process for the following combination of color bands:

1)  Red = 1st digit = 2

2) Black = 2nd digit = 0

3) Green = multiplier = 10e5

4) Nothing = tolerance = +/- 20%

This combination represents to a resistor of 2*10⁶ Ω (or 2.0 MΩ), with +/- 20% tolerance.

7 0
4 years ago
Joinn my zo om lets play some blookets<br> 98867 708157<br> 9dPQPW
pav-90 [236]

Answer:k

Explanation:

6 0
3 years ago
Rosita is planning an investigation to determine how a lifeboat's shape affects its
KiRa [710]
Yes! Is right, just did the work!
3 0
3 years ago
A compound sliding miter saw can be used to make
Sunny_sXe [5.5K]

Answer:

D

Explanation:

3 0
2 years ago
Other questions:
  • . A roadway is being designed capable of allowing 70 mph vehicle speed. The superelevation around one curve is 0.05 inches per i
    15·1 answer
  • #198. Moment of inertia about center of a segmented bar A bar of width is formed of three uniform segments with lengths and area
    7·1 answer
  • The design for a new cementless hip implant is to be studied using an instrumented implant and a fixed simulated femur.
    11·1 answer
  • A square isothermal chip is of width w = 5 mm on a side and is mounted in a substrate such that its side and back surfaces are w
    7·1 answer
  • A 40 mph wind is blowing past your house and speeds up as it flows up and over the roof. If the elevation effects are negligible
    14·1 answer
  • A bar of steel has the minimum properties Se = 40 kpsi, S = 60 kpsi, and S-80 kpsi. The bar is subjected to a steady torsional s
    6·1 answer
  • Storing parts outside doesn't cause any environmental risks as long as the items are covered.
    12·2 answers
  • A moving-coil instrument, which gives full-scale deflection with 0.015 A has a copper coil having resistance of 1.5 Ohm at 15°C
    7·1 answer
  • Is a unit of measurement for angles
    15·1 answer
  • Which of the following maintenance items helps to ensure the vehicles engine lasts as long as possible?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!