Rb.h and librb.a are files for implementing red-black trees. Rb.h may be found in /blugreen/homes/plank/cs360/include Librb.a may be found in /blugreen/homes/plank/cs360/objs Rb.h contains the typedef for red-black tree structures. Basically, red-black trees are balanced trees whose external nodes are sorted by a key, and connected in a linked list. The following is how you use librb.a and rb.h: Include rb.h in your source. Make_rb() returns the head of a red-black tree. It serves two functions: Its p.root pointer points to the root of the red-black tree. Its c.list.flink and c.list.blink pointers point to the first and last external nodes of the tree. When the tree is empty, all these pointers point to itself. The external nodes can be traversed in sorted order with their c.list.flink and c.list.blink pointers. The macros rb_first, rb_last, rb_next, rb_prev, and rb_traverse can be used to traverse external node lists. External nodes hold two pieces of information: the key and the value (in k.key and v.val, respectively). The key can be a character string, an integer, or a general pointer. Val is typed as a character pointer, but can be any pointer. If the key is a character string, then one can insert it, and a value into a tree with rb_insert(). Call rb_insert(t, k, v), where t is the root of the tree (as returned by make_rb), k is the key, and v is the value. If the key is an integer, then rb_inserti() should be used. If it is a general pointer, then rb_insertg() must be used, with a comparison function passed as the fourth argument. This function takes two keys as arguments, and returns a negative value, positive value, or 0, depending on whether the first key is less than, greater than or equal to the second. Thus, rb_insert(t, k, v) is equivalent to rb_insertg(t, k, v, strcmp). Rb_find_key(t, k) returns the external node in t whose value is equal to k or whose value is the smallest value greater than k. (Here, k is a string). If there is no value greater than or equal to k, then t is returned. Rb_find_ikey(t,k) works when k is an integer, and Rb_find_gkey(t,k,cmp) works for general pointers. Rb_find_key_n(t, k, n) is the same as rb_find_key, except that it returns whether or not k was found in n (n is an int *). Rb_find_ikey_n and Rb_find_gkey_n are the analogous routines for integer and general keys. Rb_insert_b(e, k, v) makes a new external node with key k and val v, and inserts it before the external node e. If e is the head of a tree, then the new node is inserted at the end of the external node list. If this insertion violates sorted order, no error is flagged. It is assumed that the user knows what he/she is doing. Rb_insert_a(e,k,v) inserts the new node after e (if e = t, it inserts the new node at the beginning of the list). FOR ALL APPLICATIONS IN THIS CLASS, YOU WILL NOT NEED TO USE rb_insert_b() or rb_insert_a(). Instead, rb_insert() (or rb_inserti() or rb_insertg()) will work fine. Rb_delete_node(e) deletes the external node e from a tree (and thus from the linked list of external nodes). The node is free'd as well, so don't retain pointers to it. Red-black trees are nice because find_key, insert, and delete are all done in log(n) time. Thus, they can be freely used instead of hash-tables, with the benefit of having the elements in sorted order at all times, and with the guarantee of operations being in log(n) time.