Expression trees

Published

2023-08-05

Expression trees provide an example for different applications of in-order and post-order traversal. We also introduce reverse Polish notation or RPN, and stack calculators.

Expression Trees / Postfix / RPN (6:10)

Additional reading:

And here’s a cool HP-35 RPN calculator emulator (at least, I think it’s cool):

Resources

Comprehension check

Consider this expression tree.

Expression tree
  1. What is the expression yielded by post-order traversal?
  2. What is the evaluation of this expression?

Answer (expression): + ᄅƃol % / ㄥ 0ㄥ + 8 0Ɛ ᄅƃol + - ᄅƖ 8 x ᄅƖ Ɛ

Answer (numeric): 8

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.