Build up a file on disk representing an array of strings to test the various sorting algorithms. More...
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include "buildFileBasedInput.h"
#include "problem.h"
#include "report.h"
Functions | |
| int | fileCompString (const long pos, const char *a2) |
| comparator function, by offset into file and AGAINST string in memory. | |
| int | ascending (const long pos, const void *a2) |
| comparator function for the ascending case. | |
| int | descending (const long pos, const void *a2) |
| comparator function for the descending case. | |
| 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 () |
| Validate that sorting was successful. | |
| void | execute () |
| Execute by invoking malloc(numElements) a total of numT times. | |
| void | problemUsage () |
| No specific problem usage. | |
Variables | |
| FILE * | strings |
| information is stored on disk accessed via FILE handle. | |
Build up a file on disk representing an array of strings to test the various sorting algorithms.
Required Input:
Input flags:
| int ascending | ( | const long | pos, | |
| const void * | a2 | |||
| ) |
comparator function for the ascending case.
| int descending | ( | const long | pos, | |
| const void * | a2 | |||
| ) |
comparator function for the descending case.
| void execute | ( | ) |
Execute by invoking malloc(numElements) a total of numT times.
.numElements
output sum to be sure is correct.
| int fileCompString | ( | const long | pos, | |
| const char * | a2 | |||
| ) |
comparator function, by offset into file and AGAINST string in memory.
| void postInputProcessing | ( | ) |
Validate that sorting was successful.
| 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.
| FILE* strings |
information is stored on disk accessed via FILE handle.
Algorithm Development Kit 1.0