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

FIRST GRADER essay writing company is the ideal place for homework help. If you are looking for affordable, custom-written, high-quality and non-plagiarized papers, your student life just became easier with us. Click the button below to place your order.


Order a Similar Paper Order a Different Paper

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:

Got stuck with another paper? We can help! Use our paper writing service to score better grades and meet your deadlines.

Get 15% discount for your first order


Order a Similar Paper Order a Different Paper
Writerbay.net