0% found this document useful (0 votes)
8 views2 pages

Binary Search Tree Number Management System

The document outlines the implementation of a Number Management System using a Binary Search Tree (BST), detailing its structure and key operations such as insertion, deletion, searching, and finding the maximum value. It emphasizes the efficiency of BST in managing numbers through recursive methods and inorder traversal for sorted display. The assignment showcases practical applications of BST with sample outputs demonstrating its functionality.

Uploaded by

zakwwp5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Binary Search Tree Number Management System

The document outlines the implementation of a Number Management System using a Binary Search Tree (BST), detailing its structure and key operations such as insertion, deletion, searching, and finding the maximum value. It emphasizes the efficiency of BST in managing numbers through recursive methods and inorder traversal for sorted display. The assignment showcases practical applications of BST with sample outputs demonstrating its functionality.

Uploaded by

zakwwp5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Number Management System using Binary Search

Tree (BST)
Student VUID: bc240405742

Introduction
This assignment implements a Number Management System using a Binary Search Tree (BST). A
BST is a hierarchical data structure that stores data in an ordered manner, allowing efficient
insertion, deletion, searching, and traversal operations.

Objectives
1 Insert numbers into BST using recursion
2 Display numbers using inorder traversal
3 Delete a node handling all deletion cases
4 Search a value using recursive approach
5 Find the maximum value in BST

BST Node Structure


Each node contains an integer value and two pointers: left and right. Left child stores smaller
values, while right child stores larger values.

Operations Explanation

1. Insert Operation
Insertion is done recursively. If the tree is empty, a new node is created. If the value is smaller than
root, it goes to left subtree, otherwise to right subtree.

2. Inorder Traversal
Inorder traversal visits nodes in the order: Left → Root → Right. This traversal displays BST
elements in sorted order.

3. Delete Operation
Deletion handles three cases: node with no child, node with one child, and node with two children.
In case of two children, inorder successor is used.

4. Search Operation
Searching compares the target value with the current node and recursively moves left or right until
the value is found or tree ends.

5. Find Maximum Value


Maximum value is found by traversing to the right-most node of the BST.
Sample Output
The program inserts predefined values, displays inorder traversal, deletes a value, searches for a
number, and prints the maximum value stored in BST.

Conclusion
This assignment demonstrates efficient use of Binary Search Tree using recursion. BST provides
fast operations and maintains sorted data automatically.

You might also like