Load up an array of integers and perform number of unordered searches. More...
#include <malloc.h>
#include "report.h"
Functions | |
void | construct (int n) |
Method to construct the initial search structure to contain 'sz' elements. | |
void | insert (int s) |
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 * | 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 integers and perform number of unordered searches.
void construct | ( | int | n | ) |
Method to construct the initial search structure to contain 'sz' elements.
Allocate array of 'n' elements for 'ds'.
void insert | ( | int | 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 | ( | 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. |
int* 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