Question
To implement a BTree class in C++ that allows: - the definition of the order (K) of the node (this can be implemented as a
To implement a BTree class in C++ that allows:
- the definition of the order (K) of the node (this can be implemented as a method or as a parameter directly in the constructor of the class
- A method for searching a given key "KEY" in the tree, that returns the pointer to the node that contains the KEY plus the integer index of the given key in that page or null if KEY is not present in the tree
- A method for insertions of integer numbers in the tree. This should take the value of order K into consideration, meaning that each node must store m elements where: K/2 <= m <= K
- A method for deletions of integers numbers from the tree. Remember to consider rotations and joins operations If necessary
- All three traversals: inorder, preorder, postorder
- A method to determine the height of the tree
Should also be implemented an external program that instantiates an object of this class using K = 50000 and inserts 1 million (1.000.000) DISTINCT random numbers and determines the height of the resulting tree.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started