Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Create a binary tree as displayed below. Insert nodes with the values display

ID: 3803036 • Letter: 1

Question

1. Create a binary tree as displayed below. Insert nodes with the values displayed in the figure.

                                                                      21

                                          11                                           26

                         6                     19                        23                   29

                    4       9              15     20             22     24

2. Traverse the binary tree by using the following three traversal methods:

               Preorder

                Inorder

                Postorder

This should be coded in C++

                                                                      21

Explanation / Answer

In the insertion it checks from the root for the correct position of the node, if the node value less than parent then it goes as left child otherwise it will be right child.

All the traversals also start from the root, and based on the orders it prints the nodes.