Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include #define LIMIT 50 #define RAND_RANGE 100 int source[LIMIT]; // array to hold input data values int dest[LIMIT]; // array to hold

#include
#include
#include
#include
#define LIMIT 50
#define RAND_RANGE 100
int source[LIMIT]; // array to hold input data values
int dest[LIMIT]; // array to hold sorted data values
// use "dest" only if you are using two arrays
bool valid[LIMIT]; // array that indicates which input values are valid
// use "valid" only if you are using two arrays
int i; // loop variable
int j; // loop variable
int smallest; // current smallest element
int main(){
//seed random numbers
srand((unsigned)time(NULL));
//initialize valid array - at begining the full array is valid
for (i=0; i
valid[i] = true;
}
//initialize source array with random number from 0..RAND_RANGE
for (i=0; i
source[i] = rand() % RAND_RANGE;
}
//print out source array in rows of 20 elments
printf("Source array: ");
for (i=0; i < ((LIMIT/20)+1); i++) {
for (j=0; j<20; j++) {
if (i*20+j < LIMIT) {
printf("%.2d ",source[i*20+j]);
}
}
printf(" ");
}
printf(" ");
//selection sort
for (i=0; i
// INSERT YOUR CODE HERE
}
//print out sorted array in rows of 10
// INSERT YOUR CODE HERE
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions