-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrbmap.h
43 lines (30 loc) · 851 Bytes
/
rbmap.h
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
//
// Created by CJMoo on 12/3/2023.
//
#ifndef PROJECT3_RBMAP_H
#define PROJECT3_RBMAP_H
#include <string>
#include <utility>
class rbmap {
struct Node {
std::string key;
std::string value;
// Color boolean, black = false
bool red;
// Whether or not node is the left child of its parent, right = false
bool parent_left;
Node* left;
Node* right;
Node* parent;
Node(Node* parent_node, bool direction_left);
Node(Node* parent_node, bool direction_left, std::string& new_key, std::string& new_value);
};
Node* head;
void balance(Node* node);
public:
rbmap();
void insert(std::string new_key, std::string new_value);
std::string find(std::string key);
std::string operator[](std::string key);
};
#endif //PROJECT3_RBMAP_H