-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
27 lines (22 loc) · 648 Bytes
/
node.h
File metadata and controls
27 lines (22 loc) · 648 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
#ifndef __NODE_H__
#define __NODE_H__
#define AEXPRSZ 64
struct NODE {
char* info;
struct NODE* parent;
struct NODE* left;
struct NODE* right;
};
// preorder tree traversal (root, left, right)
// - used to solve any arithmetic expression
// from its Abstract Syntax Tree (AST)
void preorder(struct NODE*);
// postorder tree traversal (left, right, root)
void postorder(struct NODE*);
// inorder tree traversal (left, root, right)
void inorder(struct NODE*);
// returns a pointer to a created NODE
struct NODE* createNode(struct NODE*);
// return the max depth of a given tree
int getDepth(struct NODE*);
#endif // __NODE_H__