Skip to content
/ BST Public

Analysis and Design of Data Structures and Algorithms Laboratory - Binary Search Tree node

Notifications You must be signed in to change notification settings

netteNz/BST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BST (Binary Search Tree)

This project is a C++ implementation of a Binary Search Tree (BST) for educational purposes. It is designed for the Analysis and Design of Data Structures and Algorithms Laboratory. The project showcases basic operations of a BST, such as insertion, searching, and traversal.

Features

  • Insertion: Adds new nodes to the binary search tree while maintaining the BST property.
  • Search: Allows searching for specific values in the tree.
  • Traversal: Supports in-order, pre-order, and post-order traversal of the tree.
  • Deletion (Planned): Future improvements may include node deletion functionality.

Project Structure

  • main.cpp: The main file that demonstrates the use of the BST class by inserting, searching, and traversing nodes.
  • BSTree.h: Contains the declaration of the BSTree class which includes methods for tree operations.
  • BSTNode.h: Defines the structure of a node in the BST.

Installation

  1. Clone the repository:

    git clone https://github.com/netteNz/BST.git
    cd BST
  2. Compile the project (For Linux, ensure you have a C++ compiler like g++):

    g++ main.cpp -o bst
  3. Run the executable:

    ./bst

Usage

The project currently provides a simple example in main.cpp. It demonstrates inserting nodes into the BST and performing various traversals. To modify or test different functionality, you can update the code in main.cpp.

Example usage:

BSTree tree;
tree.insert(5);
tree.insert(3);
tree.insert(7);

tree.inOrderTraversal();  // Outputs: 3 5 7

About

Analysis and Design of Data Structures and Algorithms Laboratory - Binary Search Tree node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages