#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include "report.h"
Functions | |
void | construct (int n) |
Method to construct the initial search structure to contain 'sz' elements. | |
void | insert (int value) |
Method to insert an integer element into the search structure. | |
int | search (int target, int(*cmp)(const int, const int)) |
Method to search for an integer element in the search structure. | |
Variables | |
static int | idx = 0 |
Current integer to be added to the generated input file. | |
static int | num = 0 |
The number of elements to be generated/found in the input file. | |
static int | reported = 0 |
Record whether the input file has been created or not. | |
static FILE * | fp |
handle to the file being generated/read. | |
static char * | input = "input.dat" |
Location of file that is created during 'construction' phase and which is loaded during the 'search' phase. |
void construct | ( | int | n | ) |
Method to construct the initial search structure to contain 'sz' elements.
Creates a file on disk into which binary integer values are to be written.
void insert | ( | int | value | ) |
Method to insert an integer element into the search structure.
In our case, we are receiving the values ALREADY IN SORTED ORDER in which case we simply write into the FileHandle associated with the generated file.
value | Value to be inserted. |
int search | ( | int | target, | |
int(*)(const int, const int) | cmp | |||
) |
Method to search for an integer element in the search structure.
target | the desired target | |
cmp | the comparison function between two string elements. |
FILE* fp [static] |
handle to the file being generated/read.
int idx = 0 [static] |
Current integer to be added to the generated input file.
char* input = "input.dat" [static] |
Location of file that is created during 'construction' phase and which is loaded during the 'search' phase.
int num = 0 [static] |
The number of elements to be generated/found in the input file.
int reported = 0 [static] |
Record whether the input file has been created or not.
Algorithm Development Kit 1.0