GNU libavl 2.0.1
Author: Ben Pfaff

15 Red-Black Trees with Parent Pointers |

As our twelfth and final example of a table data structure, this chapter will implement a table as a red-black tree with parent pointers, or "PRB" tree for short. We use prb_ as the prefix for identifiers. Here's the outline:

    551. <prb.h 551> =
    <License 1>
    #ifndef PRB_H
    #define PRB_H 1

    #include <stddef.h>

    <Table types; tbl => prb 14>
    <RB maximum height; rb => prb 195>
    <TBST table structure; tbst => prb 250>
    <PRB node structure 553>
    <TBST traverser structure; tbst => prb 267>
    <Table function prototypes; tbl => prb 15>

    #endif /* prb.h */

    552. <prb.c 552> =
    <License 1>
    #include <assert.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "prb.h"

    <PRB functions 554>

Sections:

- 15.1 Data Types
- 15.2 Operations
- 15.3 Insertion
  - 15.3.1 Step 2: Insert
  - 15.3.2 Step 3: Rebalance
  - 15.3.3 Symmetric Case
- 15.4 Deletion
  - 15.4.1 Step 2: Delete
  - 15.4.2 Step 3: Rebalance
  - 15.4.3 Step 4: Finish Up
  - 15.4.4 Symmetric Case
- 15.5 Testing

14.8 Testing | Table of Contents | 15.1 Data Types