PreviousUp

Red-Black Trees: Sets and the Set Api

The Mythryl Red-Black tree implementations come in two broad sets of variants:

The sets are essentially the map implementations, only storing keys but no values. They provide a strict subset of the capabilities of the map variants. Consequently we will forbear covering the Set variants in the detail with which we covered the Map variants.

One minor difference is that since the get function no longer makes sense in the absence of per-key values, we replace it with a member function for testing key membership in a set:

    linux$ my

    eval:  package set = string_set;

    eval:  s = set::empty;

    eval:  s = set::add( s, "Key1" );
    eval:  s = set::add( s, "Key2" );
    eval:  s = set::add( s, "Key3" );

    eval:  set::member( s, "Key2" );

    TRUE

    eval:  set::member( s, "Key4" );

    FALSE

Comments and suggestions to: bugs@mythryl.org

PreviousUp