Question: Please explain the codes in each line. Its pointer lab in C 58 * Selection sort is a sorting algorithim that works by partitioning the

Please explain the codes in each line. Its pointer lab in C58 * Selection sort is a sorting algorithim that works by partitioningPlease explain the codes in each line. Its pointer lab in C

58 * Selection sort is a sorting algorithim that works by partitioning the array into 69 * a sorted section and unsorted section. Then it repeatedly selects the minimum element * from the unsorted section and moves it to the end of the sorted section. -70 * 71 72 73 174 * So the pseudo-code might look something like this: * arr - an array *n - the length of arn * 75 76 * 77 78 * * 79 80 * for i = 0 ton - 1 minIndex = i for j = i + 1 to n if arr[minIndex] > arr[j] minIndex = j end if end for Swap(arr[i], arr(minIndex)) * end for 81 * 82 * * 83 84 * 85 86 * Implement selection sort below, it might be helpful to use the swapInts function you * defined earlier. * 87 88 89 90 91 * * * ALLOWED : Pointer operators: *, & Binary integer operators: -, +, *, ==, !=, Unary integer operators: ! Shorthand operators based on the above: ex. +=, dyr, ++, --, etc. Control constructs: for, while, if Function calls: swapInt() * * 92 93 94 95 96 97 98 * * * * 99 * DISALLOWED: Pointer operators: [] (Array Indexing Operator) Binary integer operators: &, &&, I, II, , >, ^, / Unary integer operators: ~, - * * 00 * 01 02 void selection Sort(int arril, int arrLength) { 03 int i, j, min_index; 04 05 // Your code here 06 07 for(i=0; i *(arr+j)) 13 14 min_index = j; 15 } 16 } 17 swap Ints((arr+i), (arrumin_index)); 18 } 19 } 6 1 8

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!