Starting with the 2-3 tree from question 4), insert the elements 19 and 29. Sketch the tree after each insertion.

What will be an ideal response?


In inserting 19, the first comparison is against 17, the root node. The next comparison is against 23, the right
child of 17. The node containing 23 is a leaf node, so 19 is inserted into the node containing 23, making it a 3-node. The tree
looks like this:
(17)
/ \
(13) (19 23)

Inserting 29 will lead to the same leaf node containing 19 and 23. However, inserting 29 violates the number of elements in a
node, so the middle element, 23, is moved up to share the root node with 17. The tree looks like this:

(17 23)
/ \
(13) (19 29)

However, this still violates the rules for a 2-3 tree. The root node is a 3-node but it only has 2 children. The right leaf node is
split into two leaf nodes. The resulting tree is now:

(17 23)
/ | \
(13) (19) (29)

The root is a 3-node and has 3 children. Each leaf node is a 2-node.

Computer Science & Information Technology

You might also like to view...

In order to be effective, each control structure needs to embody a(n) ____________________ set of controls.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following could you use to declare the iterator p? Why?

Suppose you want to run code that involves the loop ``` //Assume vector v and iterator p has been defined and //given appropriate values for (p = v.begin(); p != v.end(); p++) cout << *p << “ “; ``` ``` std::vector::iterator p; std::vector::const_iterator p; ```

Computer Science & Information Technology

In order to display nonprinting characters on the screen, you would need to use the ________ command found on the Menu bar

Fill in the blank(s) with correct word

Computer Science & Information Technology

Examine how you would use an AND condition in a query.

What will be an ideal response?

Computer Science & Information Technology