Search/searchInteger.c File Reference

Task to perform searches in unordered array

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.


Detailed Description

Task to perform searches in unordered array

Load up an array of integers and perform number of unordered searches.

Author:
George Heineman
Date:
6/15/08

Function Documentation

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.

Parameters:
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.

Parameters:
target the desired target
cmp the comparison function between two string elements.


Variable Documentation

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