SparkNotes Shopping Cart  |     |  Checkout
Brought to you by Barnes and Noble
Introduction to Trees
 
 
Problems
It is possible to represent arithmetic, parenthesized expressions using a tree. If a node is an operator, such as a plus or a division sign, then each of the two children must be either a number or an expression which will evaluate to a number. In other words, the two children of an operator will be its operands.
Figure 1.5: Simple Arithmetic Tree
The above represents (3 + 4).
Problem 1.1: Convert the following expression into such a tree: ((3 + 4)*5)/6 [Solution]
Problem 1.2: Convert the following expression into such a tree: 3 + 4*(5/6) [Solution]
Problem 1.3: How could you use this tree representation to devise a scheme to represent the expressions without using any parentheses. Hint: Consider a the different sorts of traversals. See the recursion SparkNote for information on tree traversals. [Solution]
Help | Feedback | Make a request | Report an error | Send to a friend
 
Beat the SAT II Math IC test with the latest book from the experts at SparkNotes.
More...
 
SparkNotes Study Cards boil down Organic Chemistry into digestible tidbits, making studying easier.
More...
 
 
Go to top