1
0
Fork 0
C_lib/nodes/rb_tree_node.h

39 lines
1.2 KiB
C

/*
* C_lib Copyright (C) 2021 Wael Karram.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This header defines a node in a binary tree. */
#ifndef RED_BLACK_TREE_NODE_H
#define RED_BLACK_TREE_NODE_H
/* This enum is used to define node colors. */
enum rb_color_t { BLACK, RED };
typedef enum rb_color_t rb_color_t;
/* This struct defines a red-black tree node. */
typedef struct rb_tree_node_t {
/* Parent node. */
struct rb_tree_node_t *parent;
/* Right node. */
struct rb_tree_node_t *right;
/* Left node. */
struct rb_tree_node_t *left;
/* Color. */
rb_color_t color;
/* Data. */
void *data;
} rb_tree_node_t;
#endif /* RED_BLACK_TREE_NODE_H */