Bubble up the order
The starter reads a count and then that many values, in a tangle, into the word array tangle. Bubble sort them in place, smallest first; the print loop at the bottom will show whatever order the memory ends up in.
Bubble sort is two nested loops: the outer one counts passes, the inner one walks adjacent pairs, swapping any pair that is out of order. Both elements of a pair load with the scaled-index form, [base_r, j_r, sxtw 2], which adds the index times 4 (the size of a word) to the base address. A swap is storing them back in each other's slots. After each pass the largest remaining value has bubbled to the end, so the inner walk can shrink as the passes go by.
What is checked
- the values, one per line, in ascending order
- the program exits cleanly
- the sort rearranges memory (
strpresent, comparisons present) - the same holds for other arrays you do not see: one value, already sorted, reversed, and repeats
specification
strcmpWe run your program on the input above and on the hidden ones, and compare what it does. Nothing is matched against a stored solution.