#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <stdio.h>
#include <math.h>
#include "buildDoubleBasedInput.h"
#include "problem.h"
#include "report.h"
Functions | |
int | doubleComp (double *a1, double *a2) |
comparator function for double elements. | |
int | ascending (double *a1, double *a2) |
comparator function for ascending order. | |
int | descending (double *a1, double *a2) |
comparator function for descending order. | |
void | killer (double *combined, int numElements) |
Implementation of killer-of-three median derived from: http://ralphunden.net/content/tutorials/a-guide-to-introsort/. | |
void | prepareInput (int size, int argc, char **argv) |
Construct a random string of size ssize and have 'str1' and 'str2' be allocated strings with the same contents. | |
void | postInputProcessing () |
After sorting, can check whether sort succeeded. | |
void | execute () |
Execute by invoking malloc(numElements) a total of numT times. | |
void | problemUsage () |
No specific problem usage. | |
Variables | |
double ** | values |
where input is located in memory. |
Required Input:
Input flags:
int ascending | ( | double * | a1, | |
double * | a2 | |||
) |
comparator function for ascending order.
int descending | ( | double * | a1, | |
double * | a2 | |||
) |
comparator function for descending order.
int doubleComp | ( | double * | a1, | |
double * | a2 | |||
) |
comparator function for double elements.
void execute | ( | ) |
Execute by invoking malloc(numElements) a total of numT times.
.numElements
output sum to be sure is correct.
void killer | ( | double * | combined, | |
int | numElements | |||
) |
Implementation of killer-of-three median derived from: http://ralphunden.net/content/tutorials/a-guide-to-introsort/.
Note that the data is contiguous and we must swap as required large sequence of bytes (oh well; it won't count against costs).
void postInputProcessing | ( | ) |
After sorting, can check whether sort succeeded.
void prepareInput | ( | int | size, | |
int | argc, | |||
char ** | argv | |||
) |
Construct a random string of size ssize and have 'str1' and 'str2' be allocated strings with the same contents.
use character-swapping algorithm from strfry.c in glibc
http://www.koders.com/c/fidBD83E492934F9F671DE79B11E6AC0277F9887CF5.aspx
void problemUsage | ( | ) |
No specific problem usage.
double** values |
where input is located in memory.
Algorithm Development Kit 1.0