Suppose we have already inserted the values 5, 10 and 15 into an empty 2-3-4 tree. Explain what happens when we insert the value 20 into this tree.
What will be an ideal response?
Currently there is a single node in the tree containing all 3 values. When we insert 20, we cannot fit all four values in the same node, so we must split. The 3rd value (equivalently the 2nd could work as well) is promoted as parent and the values on either side become the children. The end result is a tree with three nodes: the root just has 15, its left child is a node with 5 and 10, and its right child is a node with 20.
You might also like to view...
Which of the following statements describes block scope?
a. It begins at the opening { of the class declaration and terminates at the closing }. b. It limits label scope to only the method in which it is declared. c. It begins at the identifier's declaration and ends at the terminating right brace (}). d. It is valid for one statement only.
Which of these “properties” of testing using stubs and drivers are correct?
a) Using drivers and stubs is a lot of work for not much gain. b) Using drivers and stubs avoids trying to debug a large program all at once. c) Testing the pieces is difficult to do in any significant way. You need the entire program to run a meaningful test. d) Drivers run the pieces individually. They are temporary. They can be minimal, without i/o, having only data generating code, and not doing much (except possibly validating) with the information they return. e) Stubs are short programs that are fairly easy to write. They return only minimum data necessary for the caller to be debugged.