1. Engineering
  2. Computer Science
  3. sortintegers is a function that should sort the numbers in...

Question: sortintegers is a function that should sort the numbers in...

Question details

SortIntegers is a function that should sort the numbers in ascending order. Please implement the sortIntegers function, in C, below.4 #include <stdio.h> // Include file for standart input/output 8 I/ Swaps two numbers in an array 9 I/ Input: The address of an index into an array for positions in an array. 10 void swap (int* a, int* b)f // TODO: Swap two integers in an array 12 13 14 II Provided below is a sort function. We have also 15 I/ provided a template for how to document functions 16 // to help organize your code. 17 // Name: sort 18 II Input (s): (1) array is a pointer to an integer address This is the start of some contiguous block of memory that we will sort. 20 I 21 1 22 IOutput:No value is returned, but array should be modified to store a sorted array of numbers. 23 void sortIntegers (int* array, unsigned int size) 24 25 26 27 28 II Input: A pointer to an array (i.e. the array itself points to the first index) 29 I 30 void printIntArray(int* array, unsigned int size)f 31 32 for(i=0;i< size; i=i+1 ) { (2) size tells us how big the array of data is we are sorting. / TODO: Implement insertion sort The size of the array (Because we do not know how big the array is automatically) unsigned int i; // Note: unsigned int is a datatype for storing positive integers. printf(%d ,array [i]); 34 35 printf(In); 36 37 38 39 40 1 int dataset10,1,2,3,4,5,6,7,8,9,10; 42 int dataset2 []={10,9,8,7,6,5,4,3,2,1,아; 43 int dataset3 []={0,3,2, 1,4,7,6,5,8,9,10); 44 int dataset4 []=(2,1,1,1,1,1,1,1,1,1,1); 45 int datasetS []={100,201,52 , 3223,24,55 , 623,75,8523,-9,150); 46 int dataset6-1,1,2,-3,4,5,-6,7,8,-9,10; int main() // Some test data sets.47 48 49 50 51 52 53 54 / Sort our integer array sortIntegers (datasetl, 11); sortIntegers (dataset2, 11); sortIntegers (dataset3, 11); sortIntegers (dataset4, 11); sortIntegers (dataset5, 11); sortIntegers (dataset6, 11); 56 57 58 59 60 61 62 63 64 65 // Print out an array printIntArray (datasetl, 11); printIntArray (dataset2, 11); printIntArray (dataset3, 11); printIntArray (dataset4, 11); printIntArray (dataset5, 11); printIntArray (dataset6, 11); return 0;

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution