$35
COSC2430 Homework 5: Tree
1. Introduction
You will create a C++ program to implement the B-Tree. The purpose of this homework
is to let students be familiar with the B-Tree.
2. Input and Output
a. Input file
All values that will be added to the tree separated by a space, tab, or new line.
Values will be positive.
b. Command file
Degree of the tree: Degree=value
Level to print: Level value
c. Output file
The output is a single text file.
Height of the tree and list of the numbers on the specified levels.
If the level is empty, print Empty.
d. Examples
i. Example 1
input1.txt
55 60 72
command1.txt
Degree=3
Level 2
output1.txt
Height=2
55 72
ii. Example 2
input2.txt
13 28 1 32 81
17 72 70 77 58
51 24 25 5 55
68 24 28 8 19
15 40 91 17 37
10 20 4 33 21
command2.txt
Degree=4
Level 10
Level 9
Level 2
Level 2
Level 1
Level 3
output2.txt
Height=3
Empty
Empty
5 19 21 33 70 77
5 19 21 33 70 77
13 28 51
1 4 8 10 15 17 20 24 25 32 37 40 55 58 68 72 81 91
iii. Example 3
input3.txt
228 72 177 9 284 1 169 263 237 63
22 148 114 183 98 149 232 100 54 236
command3.txt
Degree=4
Level 3
output3.txt
Height=3
1 22 54 63 98 100 148 149 169 183 232 236 263 284
3. Requirements
Please create the BTree manually.
The main C++ problem will become the executable to be tested by the TAs. The result
file should be written to another text file (output file), provided with the command line.
4. Turn in your homework
Homework 5 needs to be turned in to our Linux server, follow the link here
https://rizk.netlify.app/courses/cosc2430/2_resources/
Make sure to create a folder under your root directory, name it “hw5” (case sensitive),
copy all your .cpp and .h file to this folder, “ArgumentManager.h” need to be included as
well.
PS: This document may have typos, if you think something illogical, please email TAs for
confirmation.