#include <malloc.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 (char *s) |
Method to insert an integer element into the search structure. | |
int | search (char *target, int(*cmp)(const void *, const void *)) |
Search for the target within the array. | |
Variables | |
static char ** | ds |
Storage of string array. | |
static int | dsSize |
Number of strings in the array 'ds'. | |
static int | dsIdx |
Position into 'ds' into which the next string will be inserted. |
void construct | ( | int | n | ) |
Method to construct the initial search structure to contain 'sz' elements.
Allocate array of 'n' elements for 'ds'.
void insert | ( | char * | s | ) |
Method to insert an integer element into the search structure.
In our case, we insert the elements into a non-balancing tree.
s | Value to be inserted. |
int search | ( | char * | target, | |
int(*)(const void *, const void *) | cmp | |||
) |
Search for the target within the array.
No Check for NULL. Move up one when found by swapping elements.
char** ds [static] |
Storage of string array.
int dsIdx [static] |
Position into 'ds' into which the next string will be inserted.
int dsSize [static] |
Number of strings in the array 'ds'.
Algorithm Development Kit 1.0