Joining Two Trees
An auxiliary tree operation …
Tree operations so far have involved just one tree.
An operation on two trees: t = joinTrees(t1,t2)
- Pre-conditions:
- takes two BSTs; returns a single BST
- max(key(
t1 )) < min(key(t2 ))
- Post-conditions:
- result is a BST (i.e. correctly ordered)
- containing all items from
t1 and t2
|