-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
48 lines (38 loc) · 858 Bytes
/
tree.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
44
45
46
47
48
#ifndef TREE_H
#define TREE_H
#include <string>
class Node {
public:
Node () = delete;
Node (char d, int dep);
~Node ();
char data;
int depth;
Node * left;
Node * center;
Node * right;
int height();
void print();
void print_empty_child();
};
class Tree {
char last_tag;
Node * root;
int num_of_children;
public:
Tree () = delete;
Tree (int, bool);
Tree (const Tree&) = delete;
Tree (Tree&&) = delete;
Tree operator = (const Tree&) = delete;
Tree operator = (Tree&&) = delete;
~Tree();
public:
void add_random_children_to_parent_until_depth_limit_reached(Node* parent, int depth_limit);
void add_children_if_requested(Node* parent, int depth_limit);
void print();
void center_subtree_height();
void wide_walk();
friend class Node;
};
#endif