view Paper/src/RedBlackTreeImpl.cbc @ 27:f4b076177b9a

...
author matac42 <matac@cr.ie.u-ryukyu.ac.jp>
date Tue, 16 Jan 2024 19:31:10 +0900
parents
children
line wrap: on
line source

#include <stdio.h>

#include "../context.h"
#impl "Tree.h" as "RedBlackTree.h"
#interface "Stack.h"

extern enum Relational compare(struct Node* node1, struct Node* node2);

Tree* createRedBlackTree(struct Context* context) {
    struct Tree* tree = new Tree();
    struct RedBlackTree* redBlackTree = new RedBlackTree();

    tree->tree = (union Data*)redBlackTree;
    tree->put = C_putRedBlackTree;
    tree->get = C_getRedBlackTree;
    tree->remove = C_removeRedBlackTree;
    // tree->clear = C_clearRedBlackTree;

    redBlackTree->root = NULL;
    redBlackTree->nodeStack = createSingleLinkedStack(context);
    return tree;
}

//  ~~省略~~