Assignment 3-DS
Assignment 3-DS
Instructions
1- Assignment should be teams of two.
2- Deadline of submission is Sunday, May 18th at 11:55 pm
3- Submission will be on Google classroom.
4- Your submission should include a single zip file only , named by id1_id2.zip
(ex.: 20380022_222333812.zip).
The zip file will contain 3 cpp files: BST.h, heap.h, and main.cpp.
(note that BST.h will have both declaration & implementation of the BST & Node classes,
while heap.h will have the declaration & implementation of the heap class).
Do not use any other type of compressed files except for zip.
5- No late submission is allowed.
6- No submission through e-mails.
7- No exe file submission.
8- In case of Cheating you will get a negative grade whether you give the code to someone,
take the code from someone/internet, or even send it to someone for any reason.
9- You have to write clean code and follow a good coding style including choosing meaningful
variable names.
10- In case of wrong submission, wrong file extension/type, missing files, plagiarism, extra
submitted files, compressed files, wrong naming, the assignment will not be accepted and no
correction for these mistakes is allowed and you will lose your grade.
You will build a class for representing “task object” and another class for representing binary search
tree. The BST will store the tasks according to their duration, and will include the following
functions:
1. Insert a task (input: description, duration, and category) where equal values of duration are
added as left child.
2. Display all (in-order)
3. Search for a task (input: duration minutes, search for all tasks with the exact input duration)
SCS214: Data Structures
Assignment-3: BST/Heap Trees
4. Remove a task (input: duration minutes, remove all tasks with the exact input duration)
5. Display more than (input: duration minutes, display all tasks having > or = input duration)
6. Display less than (input: duration minutes, display all tasks having < or = input duration)
Implement Min-heap tree to store tasks objects based on task duration. The heap tree will be used
when the user finishes a task, it will be marked as completed and removed from the binary search tree
to be stored in a heap tree. Provide the following two functions:
1. Mark task as completed (remove the task from BST and store it in min-heap)
2. Display all completed tasks based on duration ascendingly (display the completed tasks from
the least task’s duration) and the number of completed task per category.
<<Assignment Input/Output>>
In the input File, first line is number of tasks then three line per task, i.e. description, time, and
category. In main function, you will create an object of task and insert one by one into binary search
tree.
SCS214: Data Structures
Assignment-3: BST/Heap Trees
Note that in option 7, the user might enter only part of the description and can be upper or lower case,
so your search should not be case-sensitive and should match substrings.
Example:
Enter number of option: 1 Enter number of option: 3
Enter tasks description: Write a journal Enter the duration: 30
Enter duration: 5 //3 tasks are found
Enter Category: Other [Go the gym, 30, Health]
The task is added. [Prepare a Meal, 30, Food]
[Go to Library, 30, Other]
Enter number of option: 2
//11 tasks are printed Enter number of option: 4
[Write a journal, 5, Other] Enter the duration: 30
[Tidy Room, 15, Other] //3 tasks are removed
..
.. Enter number of option: 5
[Watch a podcast, 120, Self development] Enter the duration more than: 100
//2 tasks are found
[Make DS Assignment, 100, Educational]
[Watch a podcast, 120, Self development]
SCS214: Data Structures
Assignment-3: BST/Heap Trees
Insert BST 10
Remove BST 10
Search BST 10
Main Scenario 10
Total 100