-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbst.cc
32 lines (26 loc) · 971 Bytes
/
bst.cc
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
// (c) Robert Muth - see LICENSE for more info
#include "Util/bst.h"
namespace cwerg {
uint32_t bst_stats_num_finds;
uint32_t bst_stats_num_find_steps;
uint32_t bst_stats_num_adds;
uint32_t bst_stats_num_add_steps;
uint32_t bst_stats_left_rotations;
uint32_t bst_stats_right_rotations;
void DumpBstStates(std::ostream& os) {
os << "BST\n"
<< "finds:" << bst_stats_num_finds
<< " steps: " << bst_stats_num_find_steps << " avg-depth: "
<< (bst_stats_num_finds == 0
? 0
: bst_stats_num_find_steps / bst_stats_num_finds)
<< "\n\n" //
<< "adds:" << bst_stats_num_adds << " steps: " << bst_stats_num_add_steps
<< " avg-depth: "
<< (bst_stats_num_adds == 0 ? 0
: bst_stats_num_add_steps / bst_stats_num_adds)
<< "\n"
<< " left rots: " << bst_stats_left_rotations << "\n"
<< " right rots: " << bst_stats_right_rotations << "\n";
}
} // namespace cwerg