An open API service indexing awesome lists of open source software.

https://github.com/icliberen/binary-heap-trees

Binary Search Tree, Balanced Binary Tree and Heap Implementations in C++
https://github.com/icliberen/binary-heap-trees

binarysearchtree binarytree binarytrees cpp heap heapsort heapsort-algorithm maxheap maxheaps minheap minheap-structure

Last synced: about 1 month ago
JSON representation

Binary Search Tree, Balanced Binary Tree and Heap Implementations in C++

Awesome Lists containing this project

README

        

# Binary Search Tree, Balanced Binary Tree and Heap Implementations in C++

This project demonstrates multiple tree-based data structures in C++:

- **Binary Search Tree (BST):**
- Supports insertion, deletion and a visual display (both balanced and level order).
- Displays the maximum element along with its level.

- **Balanced Binary Tree:**
- Uses a balanced insertion method.
- Allows deletion of the last inserted element.
- Displays the tree and checks properties such as full, complete and perfect.

- **Heap:**
- Implements both MinHeap and MaxHeap functionalities.
- Visualizes the heap as a tree with `/` and `\` representing parent-child connections.
- Allows dynamic switching between MinHeap and MaxHeap even after creation.

---

## Features

- **Insertion & Deletion:** Easily add and remove elements in each data structure.
- **Visual Display:**
- Structured top-down visualization for both trees and heap.
- Level order (BFS) traversal for BST.
- **Heap Type Switching:**
- Change between min-heap and max-heap on the fly.
- **Tree Property Analysis:** Check if binary trees are full, complete or perfect.
- **Robust Input Handling:** Ensures only valid integer inputs are accepted.

---

## Prerequisites

- **For Building from Source:**
- [Visual Studio](https://visualstudio.microsoft.com/) (2019 or later with C++ development)
- Alternatively, a C++ compiler such as `g++` (for command-line builds)

- **For Running Pre-Built Releases:**
- No development tools required, just the executable for windows operating system

---

## How to Run the Application

### Using Visual Studio

1. **Clone the Repository:**
```bash
git clone https://github.com/icliberen/binary-heap-trees.git

### Using terminal

1. **Clone the Repository:**
```bash
git clone https://github.com/icliberen/binary-heap-trees.git

2. **Compile the Code:**
```bash
g++ -o binary_heap_trees main.cpp

4. **Run the Executable:**

On Linux or macOS:
```bash
./binary_heap_trees