No uniqueness 7 5 9 12 6 8 12 6 7 8
No uniqueness 7 9 5 12 5 9 1 6 8 12 1 6 7 8
What can we do given bst Sort INORDER-TREE-WALK(x) 1.ifx≠NII 2. then INORDER-TREE-WaLK(left[xD print keylxI INORDER-TREE-WALK(rightXD A preorder tree walk prints the root before the values in either subtree, and a postorder tree walk prints the root after the values in its subtrees
Wh d ST ? at can we do given BST ? Sort ! INORDER -TREE -WALK (x ) 1. if x ≠ NIL 2. then INORDER INORDER -TREE -WALK (l ft e [ x]) 3. print key [ x ] 4 INORDER 4. INORDER -TREE -WALK ( ri ht g [ ]) x A preord t lk er tree walk p ri t th t b f th i n ts the roo t b e fore the values in either subtree, and a postorder tree walk p ri t th t ft th l i it bt i n ts the roo t after the va lues in its subtrees
Sort
S ? ort 9 5 12 1 6 7 8
Sort
S ? ort 9 5 12 1 6 7 8
Sort
S ? ort 9 5 12 1 6 7 8