Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code, it requires a makefile also but i can make that #include #include #include sorting functions.h #define ARRAYSIZE 10 int

image text in transcribedimage text in transcribedimage text in transcribedI need help with this code, it requires a makefile also but i can make that

#include #include #include "sorting functions.h" #define ARRAYSIZE 10 int main (void) { // dynamically allocate memory space for an array int * array?tr = (int *) malloc (ARRAYSIZE * sizeof(int)); // fill the array with random integers // print the array, 10 elements per line // sort the array using selection sort and print the return value // print the array, 10 elements per line // fill the array again with random integers // print the array // sort with insertion sort and print the return value // print the array } 2. Create a file called sortingfunctions.h Write a preprocessor wrapper (following convention for constant name) and then insert the following prototypes. int selectionsort (int * const array, int size); int insertionsort (int * const array, int size ); void swap (int * numl, int * num2); void fillArray ( int * const data, int size, int min, int max ); void neat Print ( int * const data, int size, int numberline, int fieldsize ); 3. Create a file called sortingfunctions.c Write the implementation of the five functions. int selectionsort ( int * const data, int size ); sorts the array using the selection ort algorithm Caution: there are a lot of programs out there on the web that claim to be selection sort written in c. The class syllabus prohibits copying code from web sites. A grade of zero will be assigned for this assignment if the TA or instructor sees evidence that you have copied code. You You cannot use the bracket [ ] notation to access array elements. have to use pointer/offset notation. The return value is a count of the number of comparisons that are made. Specifically, you should count the number of times that the program executes an if statement that compares the values of two array elements. int insertionsort (int * const data, int size ); sorts the array using the insertion sort algorithm Caution: there are a lot of programs out there on the web that claim to be insertion sort written in c. The class syllabus prohibits copying code from web sites. A grade of zero will be assigned for this assignment if the TA or instructor sees evidence that you have copied code. You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation. The return value is a count of the number of comparisons that are made. Specifically, you should count the number of times that the program executes an if statement that compares the values of two array elements. void swap( int * numi, int * num2); Exchanges the contents of the two memory locations. void fillArray ( int * const data, int size, int min, int max ); Fills the array elements with integers from min to max (inclusive). You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation. void neat Print ( int * const data, int size, int numberline, int fieldsize ); Prints the array elements in nice, neat columns using the parameters numberline and fieldsize to control the layout. You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

=+ Are you interested in creating or

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago