The definition for binary search tree should be the one used in class (which is different from that adopted by the suggested-book authors). ► Class definition: Suggested-book definition: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than or equal the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ● bst_insert must be iterative (NOT recursive). ● bst_remove and bst_remove_max must use the algorithm described by the suggested book authors, appropriately adapted for the difference in tree definition above In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max. ● In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_max. Here is what the test output is suppose to look like: ============================== test case 1 of 990000 attempt to remove 5 values below: (sequential order) -2 8 -4 0 1 (value-sort order) -4 -2 0 1 8 from 8 values below: -8 -7 -6 -2 -1 0 1 2 gives (with 3 values successfully removed) -8 -7 -6 -1 2 ============================== test case 2 of 990000 attempt to remove 7 values below: (sequential order) 8 -3 -5 -4 5 6 4 (value-sort order) -5 -4 -3 4 5 6 8
The definition for binary search tree should be the one used in class (which is different from that adopted by the suggested-book authors). ► Class definition: Suggested-book definition: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than or equal the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ● bst_insert must be iterative (NOT recursive). ● bst_remove and bst_remove_max must use the algorithm described by the suggested book authors, appropriately adapted for the difference in tree definition above In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max. ● In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_max. Here is what the test output is suppose to look like: ============================== test case 1 of 990000 attempt to remove 5 values below: (sequential order) -2 8 -4 0 1 (value-sort order) -4 -2 0 1 8 from 8 values below: -8 -7 -6 -2 -1 0 1 2 gives (with 3 values successfully removed) -8 -7 -6 -1 2 ============================== test case 2 of 990000 attempt to remove 7 values below: (sequential order) 8 -3 -5 -4 5 6 4 (value-sort order) -5 -4 -3 4 5 6 8
The definition for binary search tree should be the one used in class (which is different from that adopted by the suggested-book authors). ► Class definition: Suggested-book definition: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than or equal the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ● bst_insert must be iterative (NOT recursive). ● bst_remove and bst_remove_max must use the algorithm described by the suggested book authors, appropriately adapted for the difference in tree definition above In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max. ● In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_max. Here is what the test output is suppose to look like: ============================== test case 1 of 990000 attempt to remove 5 values below: (sequential order) -2 8 -4 0 1 (value-sort order) -4 -2 0 1 8 from 8 values below: -8 -7 -6 -2 -1 0 1 2 gives (with 3 values successfully removed) -8 -7 -6 -1 2 ============================== test case 2 of 990000 attempt to remove 7 values below: (sequential order) 8 -3 -5 -4 5 6 4 (value-sort order) -5 -4 -3 4 5 6 8
The definition for binary search tree should be the one used in class (which is different from that adopted by the suggested-book authors).
►
Class definition:
Suggested-book definition:
A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items:
A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items:
♯
For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n
♯
For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than or equal the item in n
♯
For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n
♯
For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n
●
bst_insert must be iterative (NOT recursive).
●
bst_remove and bst_remove_max must use the algorithm described by the suggested book authors, appropriately adapted for the difference in tree definition above
In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max.
●
In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_max.
Here is what the test output is suppose to look like:
Process or set of rules that allow for the solving of specific, well-defined computational problems through a specific series of commands. This topic is fundamental in computer science, especially with regard to artificial intelligence, databases, graphics, networking, operating systems, and security.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.