#include <malloc.h>
#include <string.h>
#include "report.h"
Classes | |
struct | node |
Standard Binary tree data structure to use. More... | |
Typedefs | |
typedef node | NODE |
Standard Binary tree data structure to use. | |
typedef node * | NODE_PTR |
Standard Binary tree data structure to use. | |
Functions | |
void | construct (int n) |
Method to construct the initial search structure to contain 'sz' elements. | |
static void | insertNode (NODE_PTR node, char *value) |
Helper method to populate tree with actual nodes. | |
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 desired target within the search structure. | |
Variables | |
static NODE_PTR | root = NULL |
Head of binary tree. |
linkedListMoveToFront NODE |
Standard Binary tree data structure to use.
void construct | ( | int | n | ) |
Method to construct the initial search structure to contain 'sz' elements.
No work done since binary tree is constructed on the fly via insert(char *) method invocations.
n | the total number of elements to be inserted. |
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. |
static void insertNode | ( | NODE_PTR | node, | |
char * | value | |||
) | [static] |
Helper method to populate tree with actual nodes.
int search | ( | char * | target, | |
int(*)(const void *, const void *) | cmp | |||
) |
Search for the desired target within the search structure.
target | the desired target | |
cmp | the comparison function between two string elements. |
Algorithm Development Kit 1.0