Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include "bst.h"
- BST BSTmake(int key, BST lt, BST rt) {
- BST newnode = malloc(sizeof(struct bst_node));
- newnode->key = key;
- newnode->left = lt; newnode->right = rt;
- return newnode; }
- void BSTdestroy(BST t) {
- if (t == NULL) return;
- else {
- BSTdestroy(t->left); BSTdestroy(t->right);
- free(t); }}
- int BSTkey(BST t) { return t->key; }
- BST BSTleft(BST t) { return t->left; }
- BST BSTright(BST t) { return t->right; }
- BST BSTempty() { return NULL; }
- bool BSTisempty(BST t) { return (t == NULL); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement