In this problem we want to create a set of useful functions for arrays. These functions can then…

In this problem we want to create a set of useful functions for arrays. These functions can then be used elsewhere

when needed in further labs or other programs you create in future. In this we are also going to look at handling

arrays using pointers and using pointer arithmetic to iterate through the values.

In this task we are going to look at the following: copying, sorting and searching.

The main function in this problem does not serve any particular function other than testing out these functions and

communicating with the user. It can be modified to suit your needs.

Copying

We cannot directly copy an array using assignment in C. So to copy we need to allocate the space required for the

copy, and then copy each value into the new array.

Sorting

An array is an unsorted list of values, however it is often helpful to have the array in sorted list for further operations.

In this program we want to leave the original list in the order it is in, and put a copy (using above) into an ordered list.

There are many sorting algorithms that can be used, if interested follow this link

(https://www.toptal.com/developers/sorting-algorithms). Each algorithm has different advantages and disadvantages.

We will be looking at a simple sorting algorithm known as Bubble sort.

Bubble sort works by iteratively passing through the list and checks each adjacent pair and swaps if in the incorrect

order. There are n-1 passes (not optimized), and because the largest item in the iteration/pass will always end up at

the end of the list in that iteration, we need not iterate over it in the following iteration/pass.

Attachments:

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.