Search/searchNull.c File Reference

Task to perform searches in unordered array

Load up an array of strings and perform number of unordered searches. More...

#include <stdio.h>
#include <malloc.h>
#include "problem.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.


Detailed Description

Task to perform searches in unordered array

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

Check for NULL is used.

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 ( char *  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 ( char *  target,
int(*)(const void *, const void *)  cmp 
)

Search for the target within the linked list.

Check for NULL each time.


Variable Documentation

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