Write a program of key sorting. You should write a subroutine that accepts three arguments: array size (in words, not in bytes), array address, and comparison subroutine. You subroutine sorts an array and return array size in $v0 and array address in $v1. You subroutine should use comparing subroutine to determine if two elements is in order. Comparing subroutine accepts integers in $a0 and $a1 and returns 1 in $v0 if they're in proper order, and 0 otherwise. Write two comparing subroutines: first for $a0 < $a1, second for $a0%10 > $a1%10. Please use bubble sort algorithm (ar any other stable). Your program reads an ordinal N, then an integer T, then N integers. If T is 0, use first comparison subroutine, if T != 0, use second one. Then output an array.

9
0
34
456
2
5
567
2
2
0
42

Warning: array size must be in words, don't confuse with lecture copy+_paste ☹!

0
2
2
2
5
34
42
456
567

Another example:

15
1
49
20
29
52
39
22
23
43
44
16
52
47
30
23
24

49
29
39
47
16
44
24
23
43
23
52
22
52
20
30


CategoryHomework

HSE/ArchitectureASM/Homework_KeySort (последним исправлял пользователь FrBrGeorge 2019-12-06 13:42:45)