



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















a
b c
a b c
a
b c
d e^
f
g (^) h i j
a b d g h e i c f j
public static void inOrder(BinaryTreeNode t)
{
if (t != null) { inOrder(t.leftChild); visit(t); inOrder(t.rightChild); }
}
a
b c
b a c
a
b c
d e^
f
g (^) h i j
g d h b e i a (^) f j c
a (^) b
c (^) d
e (^) f
Gives infix form of expression (sans parentheses)!
a + b * c - d / e + f
a
b c
b c a
a
b c
d e^
f
g (^) h i j
g h d i e b j f c a
a
b c
d e^
f
g (^) h i j
Let t be the tree root.
while (t != null)
{
visit t and put its children on a FIFO queue; remove a node from the FIFO queue and call it t; // remove returns null when queue is empty
}
preorder = ab
a b
a b
inorder = ab
b a
a b
postorder = ab
b a
b a
level order = ab
a b
a b