<commit_before>/*******************************************************************************
 * DANIEL'S ALGORITHM IMPLEMENTAIONS
 *
 *  /\  |  _   _  ._ o _|_ |_  ._ _   _ 
 * /--\ | (_| (_) |  |  |_ | | | | | _> 
 *         _|                      
 *
 * RED-BLACK TREE DEFINITON
 *
 * Features:
 * 1. balanced tree
 * 2. O(logn) lookup performance
 *
 * http://en.wikipedia.org/wiki/Red_black_tree
 *     
 ******************************************************************************/

#ifndef __RBTREE_DEFS_H__
#define __RBTREE_DEFS_H__
#include <stdio.h>
#include <stdint.h>

namespace alg
{
	class RBTreeAbstract
	{
	protected:
		static const int INDENT_STEP=4;

		enum rbtree_node_color { RED, BLACK };
		typedef enum rbtree_node_color color;

		typedef struct rbtree_node_t {
			rbtree_node_t* left;
			rbtree_node_t* right;
			rbtree_node_t* parent;
			enum rbtree_node_color color;
		} *rbtree_node;

	private:
		rbtree_node m_root;

	public:
		/**
		 * init a red-black tree 
		 */<commit_msg>add rbtree_node_t virtual destructor, possible memory leak<commit_after>/*******************************************************************************
 * DANIEL'S ALGORITHM IMPLEMENTAIONS
 *
 *  /\  |  _   _  ._ o _|_ |_  ._ _   _ 
 * /--\ | (_| (_) |  |  |_ | | | | | _> 
 *         _|                      
 *
 * RED-BLACK TREE DEFINITON
 *
 * Features:
 * 1. balanced tree
 * 2. O(logn) lookup performance
 *
 * http://en.wikipedia.org/wiki/Red_black_tree
 *     
 ******************************************************************************/

#ifndef __RBTREE_DEFS_H__
#define __RBTREE_DEFS_H__
#include <stdio.h>
#include <stdint.h>

namespace alg
{
	class RBTreeAbstract
	{
	protected:
		static const int INDENT_STEP=4;

		enum rbtree_node_color { RED, BLACK };
		typedef enum rbtree_node_color color;

		typedef struct rbtree_node_t {
			rbtree_node_t* left;
			rbtree_node_t* right;
			rbtree_node_t* parent;
			enum rbtree_node_color color;
			virtual ~rbtree_node_t() {
			}
		} *rbtree_node;

	private:
		rbtree_node m_root;

	public:
		/**
		 * init a red-black tree 
		 */
{'fraction_non_alphanumeric': 0.24785510009532888, 'fraction_numerical': 0.002859866539561487, 'mean_word_length': 3.2064128256513027, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4367023', 'n_tokens_mistral': 835, 'n_tokens_neox': 732, 'n_words': 134}