Question

Write a MIPS assembly language for sorting an array of integers using non-recursive bottom-up merge sort algorithm. Your program should print the processed array after each step of the merge sort. For example, if the input array is 14 27 13 11 49 63 17 9, your program should print each sort process: Input Arra;y 14 27 13 11 49 63 17 9 Print After first Iteration 14 27 11 13 49 639 17 Print After second iteration 11 13 14 27 9 17 49 63 Print After third iteration 911 13 14 17 27 49 63

0 0
Add a comment Improve this question Transcribed image text
Answer #1

# data segment

.data size: .

word 10 #Size of first array

$a0: .word 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 #First array's elements

size2: .word 10 #Size of second array

$a1: .word -1, 0, 1, -2, 0, 2, -3, 0, 3, -4 #Second array's elements

size3: .word 10 #size of third array

main:

la $t0, $a0 #$t0 points to $a0[0]

lw $t1, size #$t1 equals number of elements in $a0[]

la $t2, $a1 #$t2 points to $a1[0]

lw $t3, size2 #$t3 equals number of elements in $a1[]

la $t4, $a0 #load base address of array into register $t4

la $t5, #load base address of array into register $t5

Assigning the array's elements to temp variables:

lw $t6,0($a0)

addiu $a0,$a0,4

lw $t7,0($a0)

addiu $a0,$a0,

4 lw $t8,0($a0)

addiu $a0,$a0,4

lw $t9,0($a0)

addiu $a0,$a0,4

lw $t10,0($a0)

addiu $a0,$a0,4

# exit program:

li $v0, 10 # terminate program

syscall

Add a comment
Know the answer?
Add Answer to:
Write a MIPS assembly language for sorting an array of integers using non-recursive bottom-up merge sort...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT