aboutsummaryrefslogtreecommitdiff
path: root/strbst.c
diff options
context:
space:
mode:
Diffstat (limited to 'strbst.c')
-rw-r--r--strbst.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strbst.c b/strbst.c
index b8b5dce..16c2e61 100644
--- a/strbst.c
+++ b/strbst.c
@@ -58,8 +58,10 @@ e b => a c
*bst = (*bst)->right; // tip = b
(*bst)->left->right = flip;
}
+// NOTE: These functions are valid because `b` is guaranteed in the
+// conditions where the rotations are called.
-int insnode(strbstnode** bst, strbstnode* new) {
+static int insnode(strbstnode** bst, strbstnode* new) {
// returns height of right node minus height of left node ("bias")
if (!*bst) { // When an empty node is reached,
*bst = new; // place the node
@@ -96,7 +98,7 @@ void insbst(strbst* bst, char* ind, void* data) {
insnode(&(bst->head), newbstnode(ind, data)); // allows recursion
}
-void* querynode(strbstnode* node, char* ind){
+static void* querynode(strbstnode* node, char* ind){
// tail-recursive finding algorithm
if (!node) return NULL; // NULL => node not found
int cmp = strcmp(ind, node->ind);