task-manager-bst-minheap

📋 Task Manager using BST and Min-Heap in C++

A C++ implementation of a task management system that combines a Binary Search Tree (BST) for active task storage and a Min-Heap for completed task tracking. Built by @omarrashraff and @minshawi0


Overview

This system loads tasks from a tasks.txt file into a BST sorted by duration. Users can insert, search, remove, and filter tasks through an interactive menu. When a task is marked as completed, it is moved from the BST into a Min-Heap which stores and sorts completed tasks by duration and generates a category report.


Data Structures

Binary Search Tree (BST) — BST.h

Stores active tasks sorted by duration as the key. Each node holds a description, duration, and category. Supports full BST operations including in-order traversal, search, insert, remove, and range filtering.

Key operations:


Min-Heap — Heap.h

Stores completed tasks sorted by duration (shortest first). Implemented as a fixed-size array-based heap with up to 30 tasks. Displays completed tasks in sorted order and generates a category breakdown report.

Key operations:


Structure

task-manager-bst-heap-cpp/
├── main.cpp       # Menu driver — file loading, BST/Heap interaction, Find_And_Remove
├── BST.h          # Node and BST class definitions and implementations
├── Heap.h         # Heap class with task struct, insert, heapify, and report
└── tasks.txt      # Input file — number of tasks followed by description, duration, category

Input File Format

tasks.txt

3
Buy groceries
30
Food
Morning workout
45
Health
Read a chapter
20
Educational

Option Action
1 Insert a new task into the BST
2 Display all tasks in sorted order (in-order traversal)
3 Search for tasks by duration
4 Remove a task by duration
5 Display tasks with duration more than a given value
6 Display tasks with duration less than a given value
7 Mark a task as completed — moves it from BST to Heap
8 Display all completed tasks sorted by duration + category report
0 Exit

Concepts Demonstrated

Concept Where Used
Binary Search Tree BST.h — sorted insertion, recursive search, in-order successor deletion
Min-Heap Heap.h — array-based heap with bubble-up insertion and heapify
File I/O main.cpp — loads tasks from tasks.txt on startup
Case-Insensitive Search Find_And_Remove — partial description matching with tolower
Dynamic Memory BST nodes allocated with new, deleted on removal
Modular Design Separate .h files for BST and Heap

How to Run

Prerequisites

Compile

g++ -o task_manager main.cpp

Run

./task_manager

Make sure tasks.txt is in the same directory as the compiled executable.


Purpose

These implementations are built for learning and understanding the foundations of tree and heap data structures. No external libraries are used — everything is implemented from scratch.


Authors