<commit_before>#include "bst.h"

static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);

struct BSTNode
{
	BSTNode* left;
	BSTNode* right;
	BSTNode* p;
	void* k;
};

struct BST
{
	BSTNode* root;
};

BST* BST_Create(void)
{
	BST* T = (BST* )malloc(sizeof(BST));
	T->root = NULL;
	return T;
}

BSTNode* BSTNode_Create(void* k)
{
	BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode));
	n->left = NULL;
	n->right = NULL;
	n->p = NULL;
	n->k = k;
}

void BST_Inorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		BST_Inorder_Tree_Walk(n->left, f);
		f(n->k);
		BST_Inorder_Tree_Walk(n->right, f);
	}
}
<commit_msg>Add BST preorder traversal function implementation<commit_after>#include "bst.h"

static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);

struct BSTNode
{
	BSTNode* left;
	BSTNode* right;
	BSTNode* p;
	void* k;
};

struct BST
{
	BSTNode* root;
};

BST* BST_Create(void)
{
	BST* T = (BST* )malloc(sizeof(BST));
	T->root = NULL;
	return T;
}

BSTNode* BSTNode_Create(void* k)
{
	BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode));
	n->left = NULL;
	n->right = NULL;
	n->p = NULL;
	n->k = k;
}

void BST_Inorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		BST_Inorder_Tree_Walk(n->left, f);
		f(n->k);
		BST_Inorder_Tree_Walk(n->right, f);
	}
}

void BST_Preorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		f(n->k);
		BST_Preorder_Tree_Walk(n->left, f);
		BST_Preorder_Tree_Walk(n->right, f);
	}
}

{'fraction_non_alphanumeric': 0.18368745716244003, 'fraction_numerical': 0.0, 'mean_word_length': 4.3090909090909095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1096342', 'n_tokens_mistral': 726, 'n_tokens_neox': 716, 'n_words': 142}