asked 41.3k views
0 votes
Given the binary search tree below: 16 5 3 2 4 7 13 9 18 17 20

(a) Show the list of keys printed with inorder-tree-walk.
(b) Show the list of keys printed with preorder-tree-walk.
(c) Show the list of keys printed with postorder-tree-walk.

asked
User Sumaya
by
8.1k points

1 Answer

1 vote

Final answer:

The given binary search tree can be traversed using inorder-tree-walk, preorder-tree-walk, and postorder-tree-walk.

Step-by-step explanation:

(a) The inorder-tree-walk on the given binary search tree would result in the following list of keys in ascending order: 2, 3, 4, 5, 7, 9, 13, 16, 17, 18, 20.

(b) The preorder-tree-walk on the given binary search tree would result in the following list of keys: 16, 5, 3, 2, 4, 7, 13, 9, 18, 17, 20.

(c) The postorder-tree-walk on the given binary search tree would result in the following list of keys: 2, 4, 3, 9, 13, 7, 5, 17, 20, 18, 16.

answered
User Dhruv
by
8.1k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.