Create the fastest sorting array code in C

Job ID: 32704783

Budget: $10 – $30 CAD

Create the fastest sorting array code in C:

1: We have a C array define as bellow:

double* CreateDoubleArray(int size)
{
double* pDoubleArray = malloc( sizeof( double )*size );
return pDoubleArray;
}
"""


2: A = CreateDoubleArray(N)

3: for i in N:
A[i] = a double

some values of A could be empty ex: A[28] = empty

4: create a c function to sort A according to the float value.

Ex:
A = A[1]= 1.02
A[2]= 3.656
A[6]= 0.56
A[8]= 0.01
A[9]= 5.36
A[10]= 62.36

here A[3,4,5,7] are not defined it is normal, should work like this. Could associate a specific value to those cases, ex: -1000.

At the end I need to recover a new integer array B of the sorted (descending or ascending inlclude an input to decide) positions: Ex: B=[10,9,2,1,6,8] here. Please pass B as an input of the function return nothing but fill properly B.

So function should be: getposition(A(array to order),B (array of positions),1 or -1(ascending or descending))

Should be very fast with array of 5000 numbers.

Thanks,

Yannick
Related categories: C Programming Algorithm Mathematics