-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (30 loc) · 889 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (30 loc) · 889 Bytes
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
#include "Tree.h"
#include <assert.h>
int main()
{
Node_t* n1 = {};
Tree_t tree = {};
// TREE_ASSERT(NodeCtor(&n1, 50, NULL, NULL));
// TREE_ASSERT(TreeCtor (&tree, n1, 1));
// TREE_ASSERT(TreeInsertInt(&tree, 30));
NodeCtor(&n1, 50, NULL, NULL);
TreeCtor(&tree, n1, 1);
TreeInsertInt(&tree, 30);
TREE_ASSERT(TreeInsertInt(&tree, 70));
TREE_ASSERT(TreeInsertInt(&tree, 10));
TREE_ASSERT(TreeInsertInt(&tree, 80));
TREE_ASSERT(TreeInsertInt(&tree, 65));
TREE_ASSERT(TreeInsertInt(&tree, 66));
// PrintPrefTree(n1);
printf("n1.data = %d\n", n1->data);
printf("n2.data = %d\n", n1->left->data);
assert(tree.root);
assert(tree.root->left);
PrintPrefTree(&tree);
PrintPostTree(&tree);
PrintInfixTree(&tree);
PrintSortTree(&tree);
printf("\n");
TREE_ASSERT(TreeDtor(&tree));
return 0;
}