Load up an array of strings and perform number of ordered searches. More...
#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 linked list. | |
Variables | |
static char ** | ds |
Array to contain final search structure. | |
static int | dsSize |
Size of the array. | |
static int | dsIdx |
Position into the array into which the next string is to be inserted. |
Load up an array of strings and perform number of ordered searches.
No check for NULL is used.
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 linked list.
char** ds [static] |
Array to contain final search structure.
int dsIdx [static] |
Position into the array into which the next string is to be inserted.
int dsSize [static] |
Size of the array.
Algorithm Development Kit 1.0