+1(805) 568 7317

compile and run the program verify that you can create a binary tree by using the r 5107661

Lab Exercise 1. Compile and run the program. Verify that you can create a binary tree, by using the ‘r’ command. (Several sample text files are provided: t ree01 . t xt, t ree 02 . txt, and t ree 03 . txt.) 2. Use the’d’ command to display the contents of the tree. Visually trace your way through the tree by following the node addresses, beginning with the value of root, and following the left and right link values. (Draw the tree on paper, if that is helpful to see its organization.)


12/2/2019 2:30 PM page 1 of 2

CIT237 C-I-F Programming

Lab 21.1 Binary Trees

3. Also try the “pre” and “post” commands, to observe the difference between the different traversal methods. 4. Try adding one or more nodes to the tree, using the T command. 5. Use the ‘n’ command to display the number of nodes present. 6. Use the ‘R’ command to remove nodes from the tree, and verify the result with the ‘d’ command. Be sure to try removing some “leaf” nodes as well as nodes with one and two “child” nodes.


"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now