Right-Threaded AVL Trees - GNU libavl 2.0.2
Author: Ben Pfaff

11 Right-Threaded AVL Trees |

In the same way that we can combine threaded trees with AVL trees to produce threaded AVL trees, we can combine right-threaded trees with AVL trees to produce right-threaded AVL trees. This chapter explores this combination, producing another table implementation.

Here's the form of the source and header files. Notice the use of rtavl_ as the identifier prefix. Likewise, we will often refer to right-threaded AVL trees as “RTAVL trees”.

    415. <rtavl.h 415> =
    <License 1>
    #ifndef RTAVL_H
    #define RTAVL_H 1

    #include <stddef.h>

    <Table types; tbl => rtavl 14>
    <BST maximum height; bst => rtavl 28>
    <TBST table structure; tbst => rtavl 250>
    <RTAVL node structure 417>
    <TBST traverser structure; tbst => rtavl 267>
    <Table function prototypes; tbl => rtavl 15>

    #endif /* rtavl.h */

    416. <rtavl.c 416> =
    <License 1>
    #include <assert.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "rtavl.h"

    <RTAVL functions 418>