Lab 4
Lab 4
Heaping it on
For the second exercise, we would like you to translate the C code that implements heap sort
shown below (and available as link on the course web page) into a MIPS assembler file named
heapSort.asm. This program expects its input to be provided through command line arguments
rather than typed in as standard input.
#include <stdio.h>
temp = *x;
*x = *y;
*y = temp;
}
} else {
swap( &values[rootIndex], &values[smallestChild] );
rootIndex = smallestChild;
smallestChild = 2*rootIndex + 1;
}
}
}
valc = argc - 1;
// HEAP SORT!
printf( "\n" );
}