(a) Draw the binary tree representation of the following arithmetic expression $(x + 10 \* d) + (g - 3 \* (a - b)) \* (4 + \frac{b}{2})$. (b) Consider the tree in the following figure: G W A Z H G F C K L Print the nodes of the tree based on: i. the inorder traversal, ii. the preorder traversal. (c) i. What is the maximum number of external nodes (leaves) of a binary tree of height $h$? (State the number without proof.) ii. Prove that a binary tree with $n!$ leaves must have height $\Omega(n \log n)$.
Added by Gonzalo F.
Close
Step 1
First, let's represent the subexpression 10 * d as a subtree. The root of this subtree will be the multiplication operator *, and its left child will be the number 10, and its right child will be the variable d. Show more…
Show all steps
Your feedback will help us improve your experience
Syed Vasi and 51 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Use structural induction to show that $n(T) \geq 2 h(T)+1$ where $T$ is a full binary tree, $n(T)$ equals the number of vertices of $T,$ and $h(T)$ is the height of $T$.
Induction and Recursion
Recursive Definitions and Structural Induction
Use structural induction to show that $l(T),$ the number of leaves of a full binary tree $T,$ is 1 more than $i(T),$ the number of internal vertices of $T .$
A binary tree T has 9 nodes. The inorder and preorder traversals of T yield the following sequences: Inorder: E A C K F H D B G Preorder: F A E K C D H G B Draw the tree T.
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD