Assignment:
Computer Science III Spring 2019
Lecture 3 Activity 2
1. Draw the binary tree representation of the following arithmetic expression: "(((5+2) ∗ (2-1))/((2+9)+((7-2)-1)) ∗8)". Hint: Review the print arithmetic expression example on Chapter Slide 26.
2. Give an O(n)-time algorithm for computing the depths of all nodes of a tree T, where n is the number of nodes of T. Write down the pseudocode. Hint: when you visit a node, you can perform some operation, for example, store some information in the node.