-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinting.cpp
More file actions
53 lines (48 loc) · 1.03 KB
/
printing.cpp
File metadata and controls
53 lines (48 loc) · 1.03 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
#include <cstdio>
#include "def.h"
#include "btree.h"
/************************ PRINTING + HELPER FUNCTIONS ************************/
void print_node(btree node) {
if (node->num_keys == 0) {
/* printf("node %d:[]", node); */
return;
}
/* printf("node %d:[", node); */
for(int i = 0; i < node->num_keys - 1; i++) {
printf("%d,", node->keys[i]);
}
printf("%d]\n", node->keys[node->num_keys-1]);
}
void print_array(int* a, int n) {
if (n == 0) {
printf("[]\n");
return;
}
printf("[");
for(int i = 0; i < n-1; i++) {
printf("%d,", a[i]);
}
printf("%d]\n", a[n-1]);
}
void print_array(btree* a, int n) {
if (n == 0) {
printf("[]\n");
return;
}
printf("[");
for(int i = 0; i < n-1; i++) {
//printf("%d,", a[i]);
}
/* printf("%d]\n", a[n-1]); */
}
void print_children(btree t) {
if (t->num_keys == 0) {
printf("[]\n");
return;
}
printf("[");
for(int i = 0; i < t->num_keys; i++) {
//printf("%d,", t->children[i]);
}
//printf("%d]\n", t->children[t->num_keys]);
}