Data Structures in Java
Session 7 Instructor: Bert Huang http://www1.cs.columbia.edu/~bert/courses/3134
Data Structures in Java Session 7 Instructor: Bert Huang - - PowerPoint PPT Presentation
Data Structures in Java Session 7 Instructor: Bert Huang http://www1.cs.columbia.edu/~bert/courses/3134 Announcements Homework 2 released on website Due Oct. 6 th at 5:40 PM (7 days) Homework 1 solutions posted Post homework to
Session 7 Instructor: Bert Huang http://www1.cs.columbia.edu/~bert/courses/3134
Shared Files, Homework #2
implementation
linear
Java class hierarchies
collections of nodes
family trees)
same parent are siblings
nodes such that the next node in the sequence is a child of the previous
length of the path from root
the maximum depth
two nodes, one is an ancestor and the other is a descendant
children
T Data; Collection<TreeNode<T>> myChildren; }
preorder(node x) print(x) for child : myChildren preorder(child)
postorder(node x) for child : myChildren postorder(child) print(x)
T element; BinaryNode<T> left; BinaryNode<T> right; }
inorder(x.left) print(x) inorder(x.right)
2 or 0 children
each leaf is at the same depth
store mathematical expressions
* + x y z / 300
Hungry? Enough money? Do nothing Chicken and Rice Subsconscious
trees
answers to questions