#ifndef BST_H_
#define BST_H_

/*
  Binary search tree that uses a word as the key value and 
  includes a count as well.
 */

typedef struct tree {
  char *word; // the "key"
  int num;    // more "data"
  struct tree *left, *right;
} tree_t;

// if word is not in the tree, insert it.
// return the root of the tree (which is created if the tree is empty)
tree_t *bst_insert(tree_t *root, char *word, int num);

// if word is in the tree, return a pointer to the tree_t node
tree_t *bst_lookup(tree_t *root, char *word);

// remove p from the tree
tree_t *bst_delete(tree_t *root, tree_t *p);

// print the tree
void bst_print(tree_t *root);


#endif