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 | #ifndef __N_BST_H__
#define __N_BST_H__
// Struct type definitions
typedef struct _BSTNode {
int value; // =4 bytes¹
struct _BSTNode* left; // =8 bytes¹
struct _BSTNode* right; // =8 bytes¹
} BSTNode; // =20 bytes¹
typedef struct _StackNode {
BSTNode* value;
struct _StackNode* next;
} StackNode;
// Function declarations
void stack_push(StackNode** a_top, BSTNode* value);
BSTNode* stack_pop(StackNode** a_top);
bool stack_is_empty(StackNode* top);
void insert(int value, BSTNode** a_root);
void destroy_tree(BSTNode** a_root);
void print_tree_in_order(BSTNode* root);
void print_tree_pre_order(BSTNode* root);
#endif /* end of include guard: __N_BST_H__ */
|
© Copyright 2023 Alexander J. Quinn This content is protected and may not be shared, uploaded, or distributed.