BST Implementation

BST insert

What

A Binary Search Tree (BST) is a fundamental data structure used to store and manage sorted data efficiently. It provides an organized structure that allows for quick searching, insertion, and deletion operations. This project was implemented in C to solidify concepts of tree-based data structures, recursion, and memory management.

free bst

How

The BST was implemented using C structures and dynamic memory allocation. Key operations such as insertion, deletion, and traversal were implemented using recursion. Special attention was given to memory management through functions to free dynamically allocated nodes.

bst successor

Reflection

Managing edge cases for deletion was particularly tricky, especially for nodes with two children. Ensuring the tree remained balanced and valid required careful debugging. However, I learned that recursion was an effective tool for tree traversal and made the process a lot easier. In the future I might implement balancing mechanisms (e.g., AVL or Red-Black Tree) to ensure better performance for unbalanced data.