#include <malloc.h>
#include <stdio.h>
#include "report.h"
Classes | |
struct | node |
Standard Binary tree data structure to use. More... | |
Typedefs | |
typedef node | NODE |
typedef node * | NODE_PTR |
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 NODE_PTR | ds |
Head of the linked list of strings. | |
static NODE_PTR | last |
Tail of the linked list of strings. |
void construct | ( | int | n | ) |
Method to construct the initial search structure to contain 'sz' elements.
Simply initialize 'ds' and 'last'.
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.
Assume ds and last are never null. When found, move the element to be at the front of the list.
NODE_PTR last [static] |
Tail of the linked list of strings.
Algorithm Development Kit 1.0