Question: The insertion of data into a tree can be done in various ways to ensure the height of the tree is minimum, and that
The insertion of data into a tree can be done in various ways to ensure the height of the tree is minimum, and that searching the tree for an item is not more than O(login) where b is the number of children on a node. Assume children are sorted left to right. a Draw separate trees with 8 nodes that include one of: balanced; binary tree; neither of these. b Write in pseudo code or code to traverse the tree and verify if it is balanced and/or binary. First consider how you will represent the edges and nodes as data in your program and used this in your code. c Then consider which traversal method you will use (pre-order, post-order or in-order), and name it in your code. d Assume your tree is binary. Now: (a) Provide pseudo code or code to carry out a breadth first search of a binary tree and explain each step (b) What is the complexity of the search? (c) What data structure did you use for the storage of nodes as your run the search above?
Step by Step Solution
There are 3 Steps involved in it
a Here are separate trees with 8 nodes for each case Balan... View full answer
Get step-by-step solutions from verified subject matter experts
