-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrbtree.cpp
More file actions
68 lines (50 loc) · 1.11 KB
/
rbtree.cpp
File metadata and controls
68 lines (50 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* rbtree.cpp
* Copyright (C) 2017 zhangyuehua <[email protected]>
*
* Distributed under terms of the MIT license.
*
* compile: g++ -std=c++11 rbtree.cpp -o rbtree
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define RED 0
#define BLACK 1
using namespace std;
struct rbtree_node {
int data;
rbtree_node* left;
rbtree_node* right;
rbtree_node* parent;
int color;
};
class RBTree {
private:
rbtree_node* root;
public:
RBTree() {
root = NULL;
}
RBTree(rbtree_node* node) {
root = node;
root->color = BLACK;
}
~RBTree() {
}
rbtree_node* create_node(int i) {
rbtree_node* node = (rbtree_node*)malloc(sizeof(rbtree_node));
node->data = i;
return node;
}
};
int main(int argc, char* argv[]) {
for (int i = 0 ; i< argc; ++i) {
// arg 0 is the app itself
std::cout<<"arg[" << i << "]" << argv[i] << std::endl;
}
/*
* add your code here
*/
return 0;
}