/////////////////////////////////////
// //
// Project Submission //
// //
/////////////////////////////////////
// Partner1: (your name here), (Student ID here)
// Partner2: (your name here), (Student ID here)
////////////////////////
// //
// main //
// //
////////////////////////
// You can modify the elements in the list ‘a’, the values attained by ‘low’ and ‘high’ to test your own cases.
MOV X7,X0 // For printing purposes only. Please try avoid using the register X7 in your implementation
ADDI X1, XZR, #0 // ‘Low’ value stored in X1
ADDI X2, XZR, #5 // ‘High’ value stored in X2 (0 and 5 are hypothetical numbers, you can put your test values)
BL QUICKSORT
ADDI X2, XZR, #0 // Initializing a counter for printing
ADDI X3, XZR, #10 // For adding a newline after each number, again for printing purposes only
BL PRINTLIST
////////////////////////
// //
// swap //
// //
////////////////////////
// input:
// X0: The address of (pointer to) the first value to be swapped
// X1: The address of (pointer to) the second value to be swapped.
// INSERT YOUR CODE HERE
////////////////////////////
// //
// partition //
// //
////////////////////////////
PARTITION:
// input:
// X0: The address of (pointer to) the first value of the unsorted array (this value does not depend on the values of ‘low’ and ‘high’)
// X1: The value of ‘low’
// X2: The value of ‘high’
// X3: TPI, which is initialized as ‘low-1’ in Quicksort function
// X4: CI, which is initialized as ‘low’ in Quicksort function
// output:
// X0: the index of the pivot in the sorted array
// INSERT YOUR CODE HERE
////////////////////////////
// //
// quicksort //
// //
////////////////////////////
QUICKSORT:
// input:
// X0: The address of (pointer to) the first value of the unsorted array (this value does not depend on the values of ‘low’ and ‘high’)
// X1: The value of ‘low’
// X2: The value of ‘high’
// INSERT YOUR CODE HERE
PRINTLIST:
SUBIS XZR, X2, #9 // You can change the immediate value corresponding to the length of the array
B.EQ PRINTLIST_LOOP_END
LSL X1,X1,#3
ADD X4,X7,X1
LDUR X1, [X4, #0]
PUTCHAR X3
ADDI X2, X2,#1
B PRINTLIST
PRINTLIST_LOOP_END: