Question: #include #define SIZE 10 typedef struct Node studentNode; void swap(studentNode *arr, int i, int j); void selectionSort(studentNode *arr, int i, int n); void printArray(studentNode *arr,

#include #define SIZE 10 typedef struct Node studentNode; void swap(studentNode *arr, int i, int j); void selectionSort(studentNode *arr, int i, int n); void printArray(studentNode *arr, int n); struct Node { char name[6]; int studentid; int coursenum; }; studentNode studentlist[SIZE] = { {"Dougy", 13, 2122}, {"Timmy", 15, 2122}, {"Emily", 18, 2123}, {"Jimmy", 14, 2120}, {"Kimmy", 11, 2123}, {"Carlo", 19, 2123}, {"Vicky", 22, 2120}, {"Anton", 12, 2322}, {"Brady", 10, 2120}, {"Sonya", 16, 2123} }; int main() { int n = SIZE; selectionSort(studentlist, 0, n); printArray(studentlist, n); return 0; } /* Utility function to swap values at two indices in an array*/ void swap(studentNode arr[], int i, int j) { studentNode temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } /* Recursive function to perform selection sort on subarray `arr[i...n-1]` */ void selectionSort(studentNode arr[], int i, int n) { /* find the minimum element in the unsorted subarray `[i...n-1]` // and swap it with `arr[i]` */ int j; int min = i; for (j = i + 1; j < n; j++) { /* if `arr[j]` is less, then it is the new minimum */ if (arr[j].studentid < arr[min].studentid) { min = j; /* update the index of minimum element */ } } /* swap the minimum element in subarray `arr[i...n-1]` with `arr[i] */ swap(arr, min, i); if (i + 1 < n) { selectionSort(arr, i + 1, n); } } /* Function to print `n` elements of array `arr` */ void printArray(studentNode arr[], int n) { int i; for (i = 0; i < n; i++) { printf("%d ", arr[i].studentid); printf("%s ", arr[i].name); printf("%d ", arr[i].coursenum); } }

Part 2: Struct Array Selection Sort

Part 2 requires that you expand your example to sort an array of structs based on the value of one of the struct elements. A complete program in C is provided in structSort.c.

Compile and execute the C program so you understand what the behavior looks like.

Examine the program so you understand the code.

Translate the selectionsort, swap and printarray functions in structsort.c to assembly

Do not modify structmain.asm

You can modify structmain.asm for debug and testing purposes.

Your code in structsort.asm must not depend on any edits you made to structmain.asm for proper operation.

Your code must be in structsort.asm.

Completely provide the selectionsort, swap and printarray functions in structsort.c to assembly structsort.asm

Here's the asm code I have right now, but please using the provide c code to fixed my asm code, and provide the selectionsort, swap and printarray functions in structsort.asm, you don't need to translate the mian function.

# Declare studentlist array .data studentlist: student: .struct Node .space 6 .word 0 .word 0 .endstruct .word 10 student1: .struct Node .string "Brady" .word 10 .word 2120 .endstruct student2: .struct Node .string "Kimmy" .word 11 .word 2123 .endstruct student3: .struct Node .string "Anton" .word 12 .word 2322 .endstruct student4: .struct Node .string "Dougy" .word 13 .word 2122 .endstruct student5: .struct Node .string "Jimmy" .word 14 .word 2120 .endstruct student6: .struct Node .string "Timmy" .word 15 .word 2122 .endstruct student7: .struct Node .string "Sonya" .word 16 .word 2123 .endstruct student8: .struct Node .string "Emily" .word 18 .word 2123 .endstruct student9: .struct Node .string "Carlo" .word 19 .word 2123 .endstruct student10: .struct Node .string "Vicky" .word 22 .word 2120 .endstruct studentlistend:

# Define utility functions .globl swap swap:

# Recursive function to perform selection sort on subarray `arr[i...n-1]` .globl selectionSort selectionSort:

.globl printArray printArray:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!