Professional Documents
Culture Documents
operations
Copying binary trees
2
testing equality
3
The satisfiability problem
– x1 ∨ (x2 ∧ ¬ x3)
4
The satisfiability problem (Cont.)
let (x1, x2, x3) take on all possible combinations of true and false
check the formula for each combination
to evaluate an expression, need to traverse its tree in postorder
5
The satisfiability problem (Cont.)
7
Threaded binary trees
Threads
9
Threads (Cont.)
10
Threads (Cont.)
11
Threads (Cont.)
12
Inorder traversal of a threaded
binary tree
if xrightThread == true,
then the inorder successor of x is xrightChild
if xRightThread == false,
then the inorder successor of x is obtained by
following a path of left-child links from the right child
of x until a node with leftThread == true
13
Inorder traversal of a threaded binary
tree (Cont.)
14
Inserting a node into a threaded
binary tree
16
Inserting a node into a threaded binary
tree (Cont.)
17