COMS W3134 Lecture Notes - Lecture 11: Binary Search Tree, Binary Tree, Tree Traversal

47 views3 pages

Document Summary

This class will be recorded and uploaded onto courseworks: hw3 posted, due 10/31. Leaf lodes explicitly operands, interior nodes must be operators: root not necessarily operator, since can be a single expression tree like 3. Inorder traversal: lists item in order: problem 1 on hw3, requires you to construct tree, output postfix, prefix, and infix expression, and evaluate the tree, code for postfix: Takes in root node of tree, prints out left subtree, right subtree, then root. Either has one, two or no children, can assume that program will pass null reference to us if tree is empty, we should be able to handle that. Tree so far looks like: push tree back into stack, push expression node 5, put + in expression node, pop stack first time to get 5, pop stack again get * node with nodes attached. Input is post fix expression, constructor takes in string that represents postfix instruction, and then assigns root.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents